September 13, 200421 yr 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
September 13, 200421 yr Look into the IsEmpty() and PatternCount() text functions. They might help you get the calculation field working.
September 14, 200421 yr Hi Mark, welcome to FM Forums. 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. 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.
September 14, 200421 yr 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