Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Radio Button effect - but on a table - interfield


whftherb
 Share

Recommended Posts

I didn't know how to title this one. Here's what I've got. Food pantry solution. Written in FM5 eons ago. Needs upgrade. I've changed it a lot and am still a novice at FM.

 

tbl_HouseHold (tbl_HH) describes attributes like addresses, phone nos. PK = RecNo

 

tbl_HouseHold_members (tbl_hhM) describes all residents/family members with attributes of names, DOB, marital status plus a field denoting the person's "Primary" status, that is, he/she is considered the "head of household". PK = PersionID (PID), fK - to tbl_HH::RecNo

 

Relationship diagram built tbl_HH tbl_hhM. Portal built on tbl_HH layout peering into tbl_hhM.

(Note there are many other tables in involved totally but these are the ones I'm concentrating on now...)

 

Inside tbl_hhM, the business rule states that there can be only one Primary per hh. That's so we know who visits, who's allowed to draw out food and so that the session reports have someone's name associated for printing. And this is where I'm stuck. I would like to have the "Primary" field be a round button which "lights up" when clicked. But there can be only one instance of this in the hhM table for that Household. Example: Joe and Mary are in tbl_hhM and linked to/belong to tbl_HH. If Joe is Primary, Mary is dimmed. But if Mary is clicked, Joe goes dim. For operating ease, I think a script gets me an interactive UI before a record is committed. Extend this out to Households with several children plus grandparents and relatives; only one of them gets the "Primary" designation for this Household. It's like a "radio button" effect you would use to choose an item on an individual record.

 

I thought maybe I'll just create another small single record table which I can populate with a script trigger and then clear as I scroll. I was close on that one but the table wouldn't feed back into tbl_hhM so I abandoned that approach. I could also see performance issues. I tried Case but then I didn't know how to size the Case function statement to fit the hhM size. It also looked too complicated - sometimes these things are begging for simple. I tried a layout behavior but that's way off base.

 

How about some hints? I know I can do it - I just don't have the right approach.

 

Thanks.

 

H

Link to comment
Share on other sites

What you need (in my opinion) is a selfjoin relationship of Household Members to Household Members based on identical Household ID; Then your "button" that designates someone as primary person runs a script that fills in a field, IsPrimary, but it first looks through the selfjoin relationship to see if someone else is already designated as primary.

 

::thinks further::

 

Actually, create a calculation field defined as Case (not Isempty (IsPrimary); Household ID) —— let's call that field HhidIfPrimary and then for your selfjoin relationship use Household ID = HhidIfPrimary AND PID ≠ PI⌅D; that makes it a relationship to the PRIMARY person in the current individual's household, if one is indeed so designated. (It also specifically disincludes the current person from being selfjoined back upon themselves). Then your script can simply warn you that there's already a primary (optional warning) and if you decide to proceed anyhow, sets the value of SelfJoin::IsPrimary to blank and then sets the local value of IsPrimary to "Yes" or 1 or whatever value you're using to indicate that this person is indeed the primary person of that household.

 

Finally, you can use conditional formatting to grey out buttons if SelfJoin::IsPrimary = 1 or "yes" (meaning that someone else is Primary).

Link to comment
Share on other sites

This thread is quite old. Please start a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

Terms of Use