Skip 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.

Calculation of text string

Featured Replies

Hello I am currently making a database for cancer research in the hospital I work at and I am trying to set a calculation field that will calculate certain regimens of chemotherapy and with summarize them as their generic name.

 

For example,

 

I have a field called "regimen" that is a text box containing the value list:

Dex

Bortezomib

CTX

Cisplatin

Adriamycin

Etoposide

Vincristine

 

For the summary field I want it to calculate whats in the regimen field and give me a chemotherapy line

 

For example, Bortezomib + Dex =Velcade

Bortezomib + dex + CTX = CyBorD

Cisplatin = DHAP

 

etc

 

I know I will have to include the paragraph symbol and I tried using the value count and filter values calculation but I fall into the problem with CyBorD and Velcade since both use Bortezomib and Dex. 

 

Thank so much for the help

 

 

Case statements evaluate in order, so if you put the CyBorD first that's one problem solved. E.g.:

Let([

Dex = Position( regimen ; "Dex" ; 1 ; 1 ) ;
Bortezomib = Position( regimen ; "Bortezomib" ; 1 ; 1 ) ;
CTX = Position( regimen ; "CTX" ; 1 ; 1 ) ;
Cisplatin = Position( regimen ; "Cisplatin" ; 1 ; 1 ) ;
// etc

result = 
Case( 
  Bortezomib & Dex & CTX ; "CyBorD" ; 
  Bortezomib & Dex ; "Velcade" ; 
  Cisplatin ; "DHAP"
    )
];

result
)

Edited by Fitch
Be sure to fix the calc (replace the "&" with "and") as described below!

For the summary field I want it to calculate whats in the regimen field and give me a chemotherapy line

 

For example, Bortezomib + Dex =Velcade

Bortezomib + dex + CTX = CyBorD

Cisplatin = DHAP

 

It's not quite clear what is the intended result here, since the Regimen field can meet more than one criteria. If you want a single result, you must specify some rules of preference.

Dex = Position( regimen ; "Dex" ; 1 ; 1 ) ;

 

This is not a good test when looking at a return separated list; it's easy to get a false positive when the list contains "Dexomicyl", "Antidexant" or "Curadex". Better use =

Dex = not IsEmpty ( FilterValues ( "Dex" ; Regimen ) )

etc.

I agree -- I did the quick/dirty version, sufficient for the given values, but it's best to future-proof it.

Wait a minute: I now notice something else, too. I might have swallowed the Position() thing, but the real Tom Fitch would not write "&" instead of "and". You must be either an identity thief or a body snatcher.

  • Author

Thank you all for the responses, I will try this out now. However, what I am afraid of is will this allow for any order of the checkboxes to be clicked or will they have to click the boxes in order that is stated in the formula? thanks

Isn't "body snatcher" too cruent ?

What does "cruent" mean?

Cruel ?  Sanguinary ?

 

( barbarity, bloodthirstiness, murderousness, truculence, brutishness )

Thank you all for the responses, I will try this out now. However, what I am afraid of is will this allow for any order of the checkboxes to be clicked or will they have to click the boxes in order that is stated in the formula? thanks

 

Clicked in any order is OK. What's important is the order that each item is evaluated in the Case calculation, because as soon as it hits one that is true, it stops evaluating.

 

Be sure to replace the "&" with "and" in my formula, and even better, use Mr. comment's variation.

 

Those pesky body snatchers...

Happens to me all the time ... every time it seems I make a mistake that's actually when they have snatched my body.  It can be a real problem.  :cry:

  • Author

Clicked in any order is OK. What's important is the order that each item is evaluated in the Case calculation, because as soon as it hits one that is true, it stops evaluating.

 

Be sure to replace the "&" with "and" in my formula, and even better, use Mr. comment's variation.

 

Those pesky body snatchers...

Thanks a lot for the advise, it did exactly what you said to do with Mr. Comment's variation and its working perfectly. This is the best FM forum, every time I post something it gets answered perfectly. I will probably have to post another question soon hahaha

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.