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

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

Recommended Posts

Posted (edited)

Hello,

I am trying to automate a constrain on a report with user parameters. There is a report that is pulled with all these conditions (already scripted in Summer 672)...

Since the report has so much data, the user likes to preview it on screen prior to printing. So if the user just wanted to see a certain dept's pages in this huge report, I would like to make button so they user inputs what dept they would like to constrain the report to

I don't know how to do this and to set up error catching on it..... we have 16 or so depts and don't want to set up 16 buttons (one for each dept).

here is what I have so far... and it's wrong

-Perform Script [ “Summer 672” ]

-Show Custom Dialog [ Title: "Dept"; Message: "Please enter Dept Code"; Buttons: “OK”, “Cancel”; Input #1: Dept::dp_code ]

-If [ (Get (LastMessageChoice) = 1) ]

-Constrain Found Set [ ]

-End If

Your advise is greatly appreciated. Thanks in advance

Edited by Guest
Posted

You would need to reenter Find Mode, set the new criteria, then use Constrain Found Set.

However, I do this type of thing a little differently. I use a Find screen, with specific fields on the layout (like Department) that allow narrowing down the report in the initial Find. The script would then be a little simpler:

...

Go to Layout [ Report Find ]

Enter Find Mode []

Go to Field [ Department ]

Pause Script [ indefinately ]

Perform Find []

Go to Layout [ Report ]

Sort Records [ Restore ]

Enter Preview Mode [ Pause ]

...

Posted

I tried it both ways... and can't seem to get it to work....

Here is the constrain script with user parameter requested:

<>

Enter Find Mode [ ]

Perform Find [ Specified Find Requests: Find Records; Criteria: Job::jb_emptype: “="Staff"” AND Contract::c_display_active:

“="Active"”

Find Records; Criteria: Job::jb_code: “=2481” AND Contract::c_display_active: “="Active"”

Find Records; Criteria: Job::jb_code: “=2482” AND Contract::c_display_active: “="Active"”

Find Records; Criteria: Job::jb_code: “=2360” AND Contract::c_display_active: “="Active"”

Find Records; Criteria: Job::jb_code: “=2361” AND Contract::c_display_active: “="Active"”

Find Records; Criteria: Contract::cn_tb_decimal_winter: “>0” AND Contract::c_display_active: “="Active"”

Omit Records; Criteria: Job::jb_empsubtype: “="Temp Hourly Intermittent"”

Omit Records; Criteria: Contract::c_display_active: “="Inactive"”

Find Records; Criteria: Job::jb_code: “=3306” AND Contract::c_display_active: “="Active"”

Find Records; Criteria: Job::jb_code: “=2355” AND Contract::c_display_active: “="Active"” ]

[ Restore ]

Show Custom Dialog [ Title: "Dept"; Message: "Please enter Dept Code"; Buttons: “OK”, “Cancel”; Input #1: Dept::dp_code ]

If [ (Get (LastMessageChoice) = 1) ]

Constrain Found Set [ ]

End If

<>

Because the find is so complex to get the report correct for payroll....I thought the constrain would be an appropriate method.... when I run Summer 672 approximately 400 records appear and if I only want to see the 20 in the Com Dept....

Your assistance is very appreciated.

Posted

Also, it works if I make buttons for each dept- approx 16-17 depts

This simple script works:

<>

Perform Script [ “Summer 672” ]

Constrain Found Set [ Specified Find Requests: Find Records; Criteria: Contract::c_display_dept: “="DO"” ]

[ Restore ]

<>

But not being experienced with user parameters steps, I am hitting a learning curve.

Thanks in advance for your time

(PS the Summer 672 script does that convoluted Find)

Posted

For narrowing by Department within the initial Find, the Deparment would need the desired criteria in each request. In this case, it would be easier to contrain the found set afterword.

The complexity of your Find criteria make me think there may be a better structure that allows a Find for just those people in the selected group (the group would include anyone in those numerous departments, or more simply, include each of those departments). I'm guessing from what's here, that this would be a Group-Department join table.

BTW: When you have Omit criteria in the Find, the Omit Records requests should be after all the Find Records requests.

Posted

BTW: When you have Omit criteria in the Find, the Omit Records requests should be after all the Find Records requests.

I thought so too, but there doesn't seem to be any way to move the lines in the Find step of Scriptmaker. I don't have arrows or any icons.

Should I do the line ordering manually?

Posted

You can duplicate the Omit lines then delete the originals.

But I prefer to use a series of New Record/Request steps followed by Set Field[]s for adding multiple requests to a Find. It's a little clearer when reading through the script and makes it easier to set dynamic criteria.

Posted

I am about to clean up the omit line order....

but how would I put in a constrain with user parameter for dept or last name or something

So for instance, out of the 400 records that pull on the report, the user wants to check that John Jones is displaying on the report.... how could I script the Custom message and Constrain?

I really am grateful for your advice and patience.

Posted

What you had was pretty close. I think this would work:

//After the initial Find

Enter Find Mode[]

Show Custom Dialog [ Title: "Dept"; Message: "Please enter Dept Code"; Buttons: “OK”, “Cancel”; Input #1: Dept::dp_code ]

If [ (Get (LastMessageChoice) = 1) ]

Constrain Found Set [ ]

Else

Enter Browse Mode[]

End If

You should probably add some error trapping to deal with the possibility of the department being left blank or not finding any records.

This topic is 6587 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.