Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7326 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Is there a way to execute a script that is named in a database value? I am building a Reports module. This reports module has a descriptive table that identifies the Layout for the report, whether the report is to display to the end user (on a separate Execute Report layout), and the script to execute before displaying the report. This last is my attempt to work around FM's inability to build a report on an SQL-type query (e.g. "SELECT * FROM people WHERE start_date <= 2002-01-01 ORDER BY start_date DESC"); in FM, the only way I have figured out to accomplish this is to create a script that performs the find/sort, and then displaying the appropriate report. However, I haven't figured out how I could execute a script based on what is stored in the Report record.

Does anyone have an answer?

Thanks.

Posted

Now that FM7 allows passing a script parameter, this is much easier. Have a script that will perform the query based upon the scriptparameter you pass to the script. Or if needed, have a test in the script to ascertain the script parameter and with if then statements run the correct script. There are many discussion on this board how to use the script parameters.

Posted

What you're suggesting is not what I want. I want to be able to pass (or retrieve) an arbitrary variable string and execute THAT command. I want to get around creating a hellacious series of If then statements to account for every entry, and then having to modify that script when I add another new report.

Posted

What were you envisioning, the user selecting a script to run from a pop-up menu? I'm afraid the only way to execute those would be the If-Then branching of a calling script.

The good news is, there are other tricks for a report module that may eliminate the number of hellacious script branches. Try GetField() to dynamically choose fields to display, sort, and summarize on a report. Use Go to Layout by calculated names.

I guess what I envision here is the user performing a find for the records to report on, then choosing the layout type, then the fields to show on the report, then how to sort and summarize. So the branching is broken up at each step.

Posted

Although I can see that my resolution can't be found in FM at this time, I want to clarify what I hope to accomplish.

What I am envisioning is the user selecting a Report from a dropdown list (the dropdown list being built dynamically from a Reports table), and selecting "View Report". At which point, my script would:

1) Open a new window for the report

2) Select the appropriate records for the report

3) Sort the result set for that report

4) Display the report in Preview mode, and

5) Close the window

The problem here, obviously, is steps 2 and 3--selecting and sorting records. The only way I know how to make these settings is through pre-specified script steps. I can hard code the functionality (i.e., create a series of If ReportName = "blah" Then perform script "Blah")--but that means my solution is complicated, and bound to get increasingly so as I add new reports.

It would be far simpler if I could create a single script to handle all my reports programmatically. This requires one of two things:

1) The ability to attach selection and sort criteria to a layout (as I mentioned in my initial post) OR

2) The ability to execute a script from a stored, passed or calculated result.

Alas, 'tis not to be.

This topic is 7326 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.