Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: field substitution from data while printing record Post Reply Post New Topic
Author Message
jxwalter
Newbie
Newbie


Joined: 29 May 2013
Location: United States
Online Status: Offline
Posts: 3
Quote jxwalter Replybullet Topic: field substitution from data while printing record
     Posted: 04 Jun 2013 at 7:27am
Hi-
I hope this is easy, because i want to do it a lot...basically i want a report to be able to change the data source of a field as it is moving through data.

In other words, while reading the records, i want the data itself to tell me where to find the actual information that will be printed:

Record1: db.substfield="{db.account_name}"
Record2: db.substfield="{@myformula}"
Record3: db.substfield="{?someparameter}"
etc...

so when it prints, when it finds the db.substfield textbox on the report, it prints whatever is in each of the contents of db.substfield, not the literal text, so i get 3 different data sources for each of the above records

Hope that makes sense...It's like i want a pointer to the data in substfield evaluated, not the data itself.

Thanks!



IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Jun 2013 at 12:00pm
I don't think it'll work.

why? because CR sees the data as the data type...probably a string...and a string is just that, a string.

you could code your formula to perform most of that, but I don't the formula part would be overly simple...but I could be wrong.

HTH
IP IP Logged
jxwalter
Newbie
Newbie


Joined: 29 May 2013
Location: United States
Online Status: Offline
Posts: 3
Quote jxwalter Replybullet Posted: 04 Jun 2013 at 12:28pm
thanks, that's what i was thinking - how could you trigger Crystal to view the field as something other than a string or number. maybe a macro code or something? i was thinking something along the lines of a whileprintingrecords formula, but im not familiar with that. if its a complicated formula that i can repeat easily, that would work too


Edited by jxwalter - 04 Jun 2013 at 12:29pm
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 04 Jun 2013 at 12:32pm
if your data returned something like:
{@formulaName} as the string value

you could code in your formula:
if {table.field} = "{@formulaName}" then @formulaName;

depending on the number of values the field could have, the formula could easily become a maintenance nightmare.

at least that is my idea of how you might go about this...not nearly as robust as you were hoping for...
IP IP Logged
jxwalter
Newbie
Newbie


Joined: 29 May 2013
Location: United States
Online Status: Offline
Posts: 3
Quote jxwalter Replybullet Posted: 04 Jun 2013 at 5:29pm
that might work - theres only a limited number of fields that might be present. the immediate goal is to simply be able to create a cover page on a report that will say whatever the search reports criteria, in plain english...

field_descript="Start Date"
field_operator=">="
field_value="{?Start_Date})

would yield on the report:
{table.field_descript} + {table.field_operator} + {@calculated_field_value}
"Start Date >= 5/1/2013" when the report is run.

The idea is that i can be fully flexible in generating a user friendly criteria statement that might have 4 or so criteria records, and i can substitute live data into any number of reports.

thanks for the suggestion, will try tomorrow


Edited by jxwalter - 04 Jun 2013 at 5:39pm
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum