Solved

How to change field names in a report layout using a script

Posted on 2006-11-30
7
344 Views
Last Modified: 2010-04-27
Is it possible to specify the name of a field to be printed on a report layout using a script ?

I have a report that has to be printed 6 different ways. The 6 reports are almost identical, where the only difference resides in the name of 1 field that changes in each of these reports. So I would like to create only 1 layout instead of 6, and use a script (or whatever technique appropriate) that would get the proper field name to print, based on a selection made by the user.

Is this possible ?

Thanks.
0
Comment
Question by:ndidomenico
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:lesouef
ID: 18048576
you can use a seventh field for the layout, calculated from the other 6 values + the report type:
7th field definition =
case (
report_type=1 ; data1 ;
report_type=2 ; data2 ;
report_type=3 ; data3 ;
report_type=4 ; data4 ;....
)

 or
use a normal 7th text field and have the print script to change its value accordingly.
0
 

Author Comment

by:ndidomenico
ID: 18049615
I think I understand your suggestion and got it to work. Thanks !
Below are the steps I used. Is this what you had in mind?:
1) Create a calculated, unstored field named Field7 which returns a Text value
2) Entered the "case..." statement in the field definition.
3) Created a global field called report_type which gets set by my script (1,2,3..)

Now, for your 2nd option, I'm not sure I understand properly. Is this 7th field a "regular" text field (not calculated, not global) and put in there one of the 6 field names ?. Could you give me more details ?

Thanks
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18050333
1
roughly, yes. the global field for the report type could have been a variable too.
2
yes, instead of using a calc. field, your script calculates the result and put it in a regular field. fairly equiv. to solution 1
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:ndidomenico
ID: 18050874
2:
In this scenario, the script must calculate the result for each and every record in the table before printing the report ?

I was hoping for a solution where the script could store in a global the name of the field that has to be printed on the layout, and use this global in the layout to get the appropriate field to print. Doesn't work that way, right ?



0
 
LVL 28

Accepted Solution

by:
lesouef earned 500 total points
ID: 18052041
2
I thought it was the same field for everybody; if this is false, then use the calc. field as it will be faster than a loop in a script
and
for your other thought, you still something to get the value from the selected field.
so assuming you store the field to be chosen in a global named "field2select", place a calc field in the layout, say "selectedFieldContent"=getfield(field2select) which will get the value of the field specified in field2select. but that means that it is the same field for all records if the field2select is global. If it has to be different, then field2select must be standard. but I still think a variable can do it... my pb is that I don't know how you decide on which field to select
0
 

Author Comment

by:ndidomenico
ID: 18053347
Thanks for the solution. Works great! I'm using the calc. field + global for the field name method.
0
 
LVL 28

Expert Comment

by:lesouef
ID: 18053361
perfect then
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Pop up windows can be a useful feature of any Filemaker database.  Though best used sparingly, they can be employed in a multitude of different ways, for example;  as a splash screen at login, during scripted processes to control user input, as pick…
Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now