Populate text field from other text fields

For HanDBase related topics that are not specific to one platform.

Populate text field from other text fields

Postby LarryR » Wed Aug 16, 2017 11:46 pm

I used to know how to do all this stuff many years ago, but once I got my databases set up, time went by, and now I've forgotten.

I'm setting up a database for my mom to track her medications. I have fields for both the trade name of the med (e.g., Zantac) and its generic name (e.g. ranitidine). For a given view, I want to display either the trade name OR the generic name—but not both, due to space limitations—depending on which name my mom is most familiar with.

I thought of creating a new text field and a checkbox field. If the box is checked, the new field will be populated by the trade name, if unchecked it will be populated by the generic name. Then the view will include the new text field but neither the generic nor trade name fields.

I can't get this to work. Any ideas on how to accomplish what I need?
LarryR
 
Posts: 18
Joined: Sat Apr 10, 2010 4:11 pm

Re: Populate text field from other text fields

Postby curtterp » Thu Aug 17, 2017 4:47 am

LarryR wrote:I used to know how to do all this stuff many years ago, but once I got my databases set up, time went by, and now I've forgotten.

I'm setting up a database for my mom to track her medications. I have fields for both the trade name of the med (e.g., Zantac) and its generic name (e.g. ranitidine). For a given view, I want to display either the trade name OR the generic name—but not both, due to space limitations—depending on which name my mom is most familiar with.

I thought of creating a new text field and a checkbox field. If the box is checked, the new field will be populated by the trade name, if unchecked it will be populated by the generic name. Then the view will include the new text field but neither the generic nor trade name fields.

I can't get this to work. Any ideas on how to accomplish what I need?


To accomplish this, you need 4 fields

  • Field 1 - Checkbox Field
  • Field 2 - Conditional Field - This will hold the data. The statement in the Conditional Field is 'If Field 1 is equal to 1 then result is field 3, else result is field 4'. You could set this field to not be visible in the edit screen so you don't try to enter something in it.
  • Field 3 - Text Field - Set this to 0% of list view
  • Field 4 - Test Field - Set this to 0% of list view

Now, when you add/edit a record, you can edit the names of the medication in the edit view, but do not see them in the list view
Have a good day

Curt
I am not a DDHSoftware employee, just a long time HanDBase user.... from Palm to Windows Mobile to Android, to iOS. Thanks to DDH, the database files transferred to each platform without a problem.
curtterp
 
Posts: 679
Joined: Tue May 26, 2009 6:41 pm
Location: Northern IL

Re: Populate text field from other text fields

Postby ddhsoftwareadmin » Thu Aug 17, 2017 7:07 am

Nice one Curt- you beat me to it! Thanks
ddhsoftwareadmin
Site Admin
 
Posts: 221
Joined: Tue Dec 09, 2008 2:13 pm

Re: Populate text field from other text fields

Postby LarryR » Thu Aug 17, 2017 3:50 pm

Ah, a CONDITIONAL field! That's the part I was forgetting.

(It didn't help me that, in the field-type selection box, Conditional doesn't show up unless you scroll down. I didn't, and so a Conditional field type didn't come to mind).

Thanks, Curtterp.
LarryR
 
Posts: 18
Joined: Sat Apr 10, 2010 4:11 pm

Re: Populate text field from other text fields

Postby curtterp » Sat Aug 19, 2017 9:01 am

LarryR wrote:Ah, a CONDITIONAL field! That's the part I was forgetting.

(It didn't help me that, in the field-type selection box, Conditional doesn't show up unless you scroll down. I didn't, and so a Conditional field type didn't come to mind).

Thanks, Curtterp.


You're welcome, Larry. I use this in my bill database to either put in the bill amount or paycheck amount into the amount field in the list view. I do that so I can keep everything on the screen in the list view without having to scroll left or right. (I also do a calculation to make the bill a negative amount so the running total field is accurate between bills and income).
Have a good day

Curt
I am not a DDHSoftware employee, just a long time HanDBase user.... from Palm to Windows Mobile to Android, to iOS. Thanks to DDH, the database files transferred to each platform without a problem.
curtterp
 
Posts: 679
Joined: Tue May 26, 2009 6:41 pm
Location: Northern IL


Return to HanDBase General Discussion

Who is online

Users browsing this forum: Bing [Bot] and 2 guests