Link to home
Start Free TrialLog in
Avatar of j_rameses
j_ramesesFlag for United States of America

asked on

Who to run a filter using multiple options from combo-box in FileMaker?

I am running FM 13 Advanced.
I created a layout as a Reprot Generator, being dynamic.
In other words, a wuser select different options for generating a report.
I have every option working except for the combo-box.
The report generator works if I choose one option, but if I choose two options, it does not work.
It only provides me with values for one of the selected options in the combo-box.
I tried a loop structure but that did not work.
Your assistance with this would be greatly appreciated.

Thank you.
Avatar of j_rameses
j_rameses
Flag of United States of America image

ASKER

Here is an image of what my report generator looks like:  User generated image
ASKER CERTIFIED SOLUTION
Avatar of Will Loving
Will Loving
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Will, thank you for your response, I was actually running that layout in 'Browse' mode.  Is it possible in browse mode?
The reason it's in browse mode is so that users can select different options with error-checking.
For example, they can only enter either an 'exact date' or a range date-but both values for the range must be included(from and to).  That is one example. Another is, when they select a name, that is a drop-down that only populates with active names only, it excludes the inactive records.

If it's possible in browse mode, do I place the global variable in the same table as the other items? Where should I exactly place it?
Will, forgot to mention that the generator when it creates a report it breaks down the items as per the 'type' that it is.  For example, type = Plastic or type = metal, or type = wood.
That's an FYI.
It's actual a global field rather than a Global variable and yes you can place it in the same table though since it's global, it really doesn't matter what table you place it in. With global fields you can reference them anywhere without worrying about whether you have a valid relationship.

You create a text field and the set the "Storage" option to "global". You would simply change your layout to have that field be where Products is - just create the field and then double-click the Products field on our layout and switch fields. If you're working in Browse Mode then I would have assumed that all your field were globals.

I'm assuming that the "Generate Report" script is taking the values entered, going in to Find Mode and generating a Find Request for what was specified in the layout. The only difference then is that you would need to move the script steps down to below the Enter Find Mode script step. They might require a small amount of editing but should mostly be correct.

With regard to the date vs date range, what I tend to do is use two date fields (again globals if you're in Browse Mode). If it's a single date they just populate the first field and if it's a range, they populate both fields and the range if from the first to the second. That way you can just let the built-in error checking for a valid date work rather than having to have fancy error checking in Browse for whether what's entered is a valid date OR date range (a date range being something that would be seen as invalid in Browse but not in Find.)

I don't see a Type field so I'm assuming that breaking out Type is simply a sorting and sub-summary issue….
Will, thank you.
It worked!!!
It now filters only the items selected.
I was beating my head before trying to get it to work.
I was reluctant to use Experts-Exchange hoping I can figure it out on my own, but was unsuccessful.

Yes, the script takes the values on the layout and then goes to a the report layout and does a find there.
Yes, the code snippet you provided is below the "Find Mode" script step.
Yes, the Type field is a sorting and sub-summary.  It turned out well.

Your idea regarding the date range sounds good.
Just trying to get a better idea in the coding for it.
Right now I have three fields for date: exactdate, datefrom, dateto: all three fields are date format not global.  If I am to use only datefrom and dateto and turn them into globals thenI won'thave to do error checking then, correct?
Will I use the same formatat as for the combobox?
Not certain on the coding for that mechanics?
This is sort of a separate question (which should be posted separately on EE) but I'll answer it here.

The date error checking will occur whether the field is set to Global storage or not, it's still a Date field and will still validate entries as such. In using two fields I would generally label them something like:

"Exact Date or Range Start" ____________
"Range End Date" ____________

For coding, I'd use something like this:

Enter Find Mode
Set Field [ someDateField ; Case( not isempty( DateFrom )  and not isempty( DateTo ) ; DateFrom & "…" & DateTo ; DateFrom )  ]
Perform Find [ ]

This calculation simply looks at the DateFrom and DateTo fields and if both have values, it concatenates them into a Range string, e.g.  "1/1/2014…12/31/2014". Otherwise it uses only the value in DateFrom, if one exists.
Good morning Will.
I had our users play around with it and they like it.
I did do the date range changes, and that made it much better in cleaning up the lines of code, thank you.
There is one issue we did hit, that only one user can use it at a time.
Is there a way to allow multiple users to use this layout?

Thanks a million.
If you prefer me to create a new post, I can do that.
Pls. advice.
What you're hitting is a record-locking issue. It might work if every field on the layout is global fields because those are unique to each user session, but I can't remember how FM deals with record-locking in that situation. This is the downside of doing it in Browse Mode in that only one user at at time can edit a record.

If using all Global fields doens't prevent the record locking - and I think it won't - then you'll probably need to create a separate table with all your search fields in it - when a user goes to run the report, a new record is created and you then let them see only that record. Once they are done with their entries you perform the Find, generate the report and then delete their search record.
Will, you were correct.
Once I made all fields global, the problem with record locking disappeared.
thank you for everything.
Will was very helpful.
Next time I will send him a link to help me with future issues.
Thanks j_rameses, you accepting my answer as the solution just pushed my FileMaker specific point total over 1,
000,000. I'm quite pleased at that  :-)
NICE!!!!!