Jump to content

Multiple find requests within loop script


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

Recommended Posts

I'm trying to create a loop script (eg. pauses for user interaction and then continues via a button) that will allow the user to select one or multiple checkbox values in a single field.  The field here will be "Fiscal Quarter" and will have multiple values (displayed as checkboxes) such as "Q4 15", "Q1 16" and so forth.  I'm not sure off the top of my head how to generate new find requests from the user clicking multiple checkboxes within a single field.  The goal would be to generate a new find request for each checkbox checked, and to remove the find request if the checkbox is subsequently unchecked.

I'd like to avoid separate hard-coded fields for each Fiscal Quarter, as these would need to be manually updated.

Before I go hammering away at this I thought I'd see if this was a process that someone has already figured out.

Thanks for your help.

Edited by davidnickerson
Link to comment
Share on other sites

I would have the value list for the checkboxes attached to a global field. When the script is fired, you now have a list of the checked values.

Count how many with ValueCount, then loop and extract each line with GetValue creating a new Find request each time.

Pseudo-code:

Set Variable [ $fiscalQuarters; Table::FiscalQuarters_g ]
Set Variable [ $count; ValueCount [ $fiscalQuarters ]
Set Variable [ $i; 1 ]
Go To Layout [ Relevant Layout ]
Enter Find Mode
Loop
 Set Field [ Table::FiscalQuarter; GetValue [ $fiscalQuarters; $i ]
 Exit Loop If [ $i = $count ]
 Set Variable [ $i; $i + 1 ]
 New Record / Request
End Loop
Perform Find

(Written off the top of my head, not tested etc )

  • Like 1
Link to comment
Share on other sites

A field formatted as checkboxes contains a list of the checked values -  so basically you are asking how to create a request for each item in a return-separated list. See an example here: http://fmforums.com/topic/99419-find-from-a-list/#comment-452506

Note that the checkbox field needs to be a global field - otherwise you may have a conflict between two users searching for different values.

 

  • Like 1
Link to comment
Share on other sites

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