Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem creating text field

Featured Replies

I am trying to develop a medical database that gives choices for a physical examination.

ie I have check boxes ie

DEVELOPMENT (Normal Delayed)

I want the print out to say

a. DEVELOPMENT (Normal) or

b. DEVELOPMENT (Delayed) or if no box is checked I want the print out to say nothing as below

c. however if left unchecked, the print out will look like:

d. DEVELOPMENT ()

Selection d. doesn't look nice so I'd rather have nothing. Is there any easy way to do this?

I've tried using a script to input data into a DEV2 field as below

If (Devlopment = "")

Set Field (Dev2; Dev2 = "")

Else

Set Field (Dev2; Dev2 = "Development: " & Development)

End if

but the result returns as "0" no matter what is checked

I've also tried to use Dev2 as a calculation field as below:

Case ( Development = "" ; "" ; Development = "normal" ; "Development normal" ; Development = "delayed" ; "Development delayed")

but nothing shows up in the Dev2 field

Can any one help

Thanks, Mark

Look into the IsEmpty() and PatternCount() text functions. They might help you get the calculation field working.

Hi Mark, welcome to FM Forums. smile.gif

You might consider radio buttons instead of checkboxes (which allow multiple selections). Your post indicates you only want one choice. Try an auto-enter calculation on your Dev2 standard text field. Unclick the box under the calculation 'Do not Replace Existing Value' in Auto-Enter so it will change if the User changes the data:

If(not IsEmpty(Development); "Development (" & Development & ")")

In FM7, If() produces 'blank' on the Else if unspecified (unlike prior versions). And the largest % of records should be evaluated first (branch prediction) because FM quits evaluating after it hits the first true so it's more efficient (also unlike prior versions). I originally started with If(IsEmpty... and then caught my thinking error.

Your Case() calc would work even if incorrectly formatted as number. I suspect it didn't work because more than one value was in the field; which is why radio buttons are better for a single choice. wink.gif

Your Set Field [] calcs produce '0' because you have Dev = "" in the calc box (and the 'equal' produces an evaluation). FM asks, Dev = ""? Yes or no and it's interpreted as boolean 0 (no). Only the "" should be in the calc box - same with your Else Set Field [] calc. I thought you might want to know why they broke on you. ... I always appreciate understanding the 'why' and not simply being given an answer, so I figured you might also.

  • Author

Thank you very much for your insight. I haven't been able to get back to it yet but hope your insights help. Thanks a lot

Mark

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.