Topic: Calculated fields using group_concat

Hi,
I know that the function group_concat () when used in a calculated field returns a string on fields that are say currency. Is there a similar function or work around that keeps the data as currency. Using group_concat I find I can not produce a report in Fast Reports that will return a total using the standard [SUM(<Report."Cost">,MasterData1)] with Cost being the original currency field. Any help would be appreciated.

Re: Calculated fields using group_concat

Hello Terry,


If no separator specified with group_concat, you will get a list of your fields separated by the default comma.


I don't known what you use a a separator for your currency, but if it as also a comma, you might have problems exploding the resulting strings into its original elements and maybe it's a clue to solve your problem.


You can specify your own separator with :

SELECT group_concat(asset_price,'|') FROM asset WHERE asset_sku IN (16749,16750,16751,16752) AND id_vendor = 1

which gives, on my database :

10.95|12.95|10.95|12.95

Now, the question I have in mind : why would you concatenate fields that you want to add between them in the first place ? Why don't you let the FastReport engine or the calculated field do the math for you ?


Cheers


Math

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Calculated fields using group_concat

Hi Math,

Thanks for the reply. And to answer your question I was trying to format a tablegrid by grouping the data and 1 field was currency. The formatting worked, but when I tried to print a report, Fast Reports saw the original currency field as text and SUM would not work. Not sure what went wrong so that is why I asked the question. Thanks again for your input.

Cheers