| Author |
Message |
RenVilo
Newbie
Joined: 24 May 2011
Online Status: Offline
Posts: 24
|

Topic: Formula to look at an array of data - Possible? Posted: 28 Jan 2014 at 9:13pm |
|
Hi guys/gals,
I'm creating a report and we basically want to change our decmial value according to the data in the table (So making it dynamic). We have a table called Decimal:
Measure DecimalPlaces
Tonne 2
Grade 1
Dumps 3
So far everything works fine except a Crosstab. I did manage to create this:
if GridRowColumnValue("Measure") = "Tonne" then
DecimalPlaces
Else
if GridRowColumnValue("Measure") = "Dumps" then
DecimalPlaces
else
0
That seems to work but the problem is the measure will be set up by the clients so some might have it as Tonne others as Tonnes and others just Ton. Is there a way to create a formula with an array or something so that it looks for that data and then uses the DecimalPlaces where it's found. Something like this:
If GridRowColumnValue("Measure" = (Search the Measure column and if there's a match) then
DecimalPlaces
Else
0
So it will kind of loop through the data of the Measure column and if there's a match to the Crosstab column value then it uses that amount of DecimalPlaces
|
IP Logged |
|
|
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 29 Jan 2014 at 4:47am |
|
you could add more rows to your decimal table.
you could create a helper table that would map all the different variations of Tonne to the Tonne entry, the same for all the other entries.
you could use a stored procedure to match the values
I am not sure if this will work, but in the record selection formula, you might be able to alter the values of a column so that they match. something like:
if left({table.field}) = "Ton" then {table.field}:="Tonne";
I really don't know if Crystal will allow this, but it might be worth the try.
Hopefully, one of these idea will lead to a solution that works for you.
|
IP Logged |
|
RenVilo
Newbie
Joined: 24 May 2011
Online Status: Offline
Posts: 24
|

Posted: 29 Jan 2014 at 7:40pm |
|
Thanks for the response Lockwelle.
Problem is that some clients might not even have Tonne or use a totally different name for that measure. We need to make this 100% dynamically else it's not going to work at all.
|
IP Logged |
|
lockwelle
Moderator
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
|

Posted: 30 Jan 2014 at 5:01am |
|
well, unless you have the user input a 'translation' there is no way to make it work...
The only other option would be to infer the size, but if all the sizes are in the same range, I am not seeing a way to differentiate between the decimal places.
I guess the flip side of the solution is to not have you set the decimal places, have the user set the name and the decimal places that they want to see for the labels. That would be the truly dynamic solution, then they can change the decimals on the report if they want to.
|
IP Logged |
|
|
|