Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7374 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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

Posted

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.

This topic is 7374 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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