Page 1 of 1

Multiple Selection Problem

PostPosted: Sat Oct 16, 2010 6:39 am
by JLKochJr
I am a self-taught relative newbie to FileMaker and apologize if my question is ridiculously simple but I have been unable to solve a problem via a review of the online documentation or via searching topics in this forum.

Ultimately, my question may stem from a misunderstanding of what is intended by the "Multiple Selection" script parameter. (My hope is that it means that the user can select multiple records in a portal or, at least, that selecting/deselecting a portal row will add/subtract the record's ID to a list contained in the FieldName_SelectedIDGlob.)

I am trying to create a pop-up window for the user to choose a number of lab tests for a given patient. I have copied (and modified field/variable references) the Select Contact { ContactID ; Multiple Selection }, Select Contact - Click on Contact {ID}, Select Contact Continue {Cancel}, and Select Contact - Find Contacts {Show All} scripts.

I have a button that performs the script Select Lab Set { LabSetID ; Multiple Selection } and passes through the script parameter: "Multiple Selection = 1".

On the Mini -Select Labs layout that the script opens, I have created a button in the portal rows performing the script: Select Lab Set - Click on Lab Set {ID} and also have it passing through the script parameter "Multiple Selection = 1".

While my hope was that this would allow the user to select/highlight multiple portal rows (either directly or while holding down Shift or Command Keys) and to have the list of LabSet record IDs sent to the SelectLabSet_SelectedIDGlob field, this does not occur. In fact, I can't see any difference between sending or not sending the "Multiple Selection = 1" parameter.

I do look forward to any help or clarification that you may have to offer.

JLKoch

PostPosted: Wed Oct 20, 2010 6:29 am
by John Sindelar
Hey Jack,

Seems we have a bug in this multiple selection code. I've gotten it repaired here but need to write up some instructions so you can effect the repair on your end. Will post them soon.

Nice catch!

- John

PostPosted: Tue Nov 09, 2010 8:29 pm
by JLKochJr
I did get it to work, eventually but I certainly anticipate that your solution is much more eloquent than mine. I do look forward to hearing back about the fix.

PostPosted: Wed Nov 17, 2010 11:43 am
by jswart
John Sindelar wrote:Hey Jack,

Seems we have a bug in this multiple selection code. I've gotten it repaired here but need to write up some instructions so you can effect the repair on your end. Will post them soon.

Nice catch!

- John


Hi John - just ran into the same issue with multiple selections. Hope you'll post a fix soon. Thanks! John Swart

Multiple Selection Process

PostPosted: Mon Dec 06, 2010 9:14 am
by jswart
John Sindelar wrote:Hey Jack,

Seems we have a bug in this multiple selection code. I've gotten it repaired here but need to write up some instructions so you can effect the repair on your end. Will post them soon.

Nice catch!

- John


Hi John! Know you've been busy with all the new Zulu features. Hoping you'll be able to post the instructions for selecting multiple items soon. I really need it for a project I'm working on now.
thanks!
John Swart

PostPosted: Mon Dec 06, 2010 9:27 am
by John Sindelar
Ack! Sorry. I'll post these today between calls. Thanks for the reminder.

PostPosted: Mon Dec 06, 2010 10:38 am
by jswart
John Sindelar wrote:Ack! Sorry. I'll post these today between call. Thanks for the reminder.

Thanks John!
John

PostPosted: Mon Dec 06, 2010 5:31 pm
by John Sindelar
Fixing the multiple selection problem...

1. Edit the script "Select Contact { ContactID ; MultipleSelection }" and add a new SetVariable line right before the comment "Record contact originally selected". Set the variable "$sc_ContactID" (without quotes) to this:

SeedCode_RemoveExtraReturns ( $sc_ContactID )

2. Edit the script "Select Contact - Click on Contact { ID }" and change the calc in the SetField statement, replacing this line...

Not IsEmpty ( FilterValues ( ID ; Contacts::_id ) ) ;

...with this one:

IsEmpty ( FilterValues ( ID ; Contacts::_id ) ) ;

3. Edit the layout "Select Contact" and click on the conditional formatting for the long which rectangle in the portal row; this is most easily clicked on at the far right edge of the portal row. Change the conditional formatting calc from this

SelectContact::SelectContact_SelectedIDGlob = Contacts::_id

...to this:

not isempty ( FilterValues ( SelectContact::SelectContact_SelectedIDGlob; Contacts::_id ) )

Note that you'll also want to do that with the conditional formatting on the fields the portal.

That's it!

PostPosted: Mon Dec 06, 2010 7:43 pm
by jswart
Thanks John, will give it a try in the morning!
John

PostPosted: Mon Dec 13, 2010 11:57 am
by jswart
Hey John - The fix works to select multiple contacts, but it seems to add a line feed to the global field when you select the first contact. If you unselect and select again then the line feed is deleted. I can trap for it when I loop through the list, but would be easier not to have it in the first place. Suggestions?
Thanks! John Swart

PostPosted: Mon Dec 13, 2010 12:23 pm
by John Sindelar
Unless I'm not following you John, this field isn't something a user sees, so the leading return doesn't matter, right?

PostPosted: Mon Dec 13, 2010 12:47 pm
by jswart
It is in the background, but it does matter because I take the SelectContact_SelectedIDGlob (which is a list in multiple selection) and put it in a variable. Then I loop through the variable grabbing each line to add the contact ID. Make sense?

PostPosted: Mon Dec 13, 2010 1:23 pm
by John Sindelar
Gotcha. So change this...

Edit the script "Select Contact - Click on Contact { ID }" and fine the SetField line. Inside that calc, replace this line...

ID & ¶ & Contacts::_id ; // add to list

...with this one:

SeedCode_RemoveExtraReturns ( ID & ¶ & Contacts::_id ) ; // add to list

Best,

John

PostPosted: Mon Dec 13, 2010 1:45 pm
by jswart
Oh Sure - works just right when you write it down. I could have sworn I tried the remove extra returns function and it botched things up. Obviously I just don't have the magic touch yet.

Thanks!
John