Query Sql Count and Business Object


Author
Message
Olivier
Olivier
StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)StrataFrame User (430 reputation)
Group: StrataFrame Users
Posts: 96, Visits: 806
Hello

I have a simple query to count in a sales graph and i group by seller

but Strata Bo ask me all primary key in my view and my query is not disctint or grouping.

Can you tell me , how you start your query with count(*) and some group by on Stratraframe
to learn and reproduce this.

thanks
Olivier,

==============================================
Asp.net C# - Strataframe - telerik
==============================================
Tags
Replies
Michel Levy
Michel Levy
Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)Advanced StrataFrame User (607 reputation)
Group: StrataFrame Users
Posts: 193, Visits: 9K
Hi Olivier,

If you don't want to use the agregating functions provided in your report engine, it is possible (I often prefer to agregate on the SQL Server).

here is a solution (there are also some other ways):

  1. create a view on the server with the count(*) and grouping you need, map a BO on that view, you have the structure (don't forget to enforce a pseudo primary key on the BO - look at "override primary key specification" in the Advanced otions of the BO, choose the columns that may identify a line) 
  2. if you need some parameters, create a stored procedure resulting in the same strcuture, having th parameters you need
  3. fill your BO with the stored procedure
That's all, guy!




Salut Olivier,

Si tu ne veux pas utiliser les fonctions d'aggrégation de ton moteur de rapport, c'est faisable (je préfère souvent faire les agrégations sur le serveur SQL).

Voilà une solution (il y en a d'autres):

  1. tu crées une vue sur le serveur, avec ton count(*) et tes group by, tu mappes un BO sur cette vue, ça te donne ta structure (n'oublie pas de forcer une pseudo PK sur le BO - regarde "override primary key specification" dans les options avancées du BO, tu choisis une combinaison de colonnes qui peuvent servir d'identifiant unique pour une ligne)
  2. si tu as besoin de paramètres, tu crées une procédure stockée qui te donne le résultat voulu, avec les paramètres nécessaires
  3. tu remplis ton BO avec la procédure stockée
Et c'est fini, mon ami!
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Olivier, Michel,

Michel is right, sometimes a view and a stored procedure to fill the view is what is needed, also if all the aggregated fields are in the view the SQL to query the view may be pretty simple no needing to have a stored procedure for it.

My preference is to try to get all calculations done at the SQL Server level so I can simply use the views in my reports or graphs with a SF Business Binding Source as clean as possible.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search