CALCTEXT issue

596 views
Skip to first unread message

Rosanne Pogash

unread,
Sep 27, 2021, 12:13:44 PM9/27/21
to redcap open
I have created a form (Confusion Assessment Camicu) using several @CALCTEXT fields.  Everything seems to be working as expected except for the Feature 3 section of the form.  The CALCTEXT field, [cam_feature3], will not display unless I hit one of the completed radio buttons a second time in that section.  That is not the case for the Feature 1 or Feature 2 areas.

I would appreciate any assistance in determining what is happening with Feature 3.

I have attached the data dictionary.

Thanks,

Rosanne

cam_data_dictionary.csv

David Edwards

unread,
Sep 27, 2021, 12:26:31 PM9/27/21
to Rosanne Pogash, redcap open
Hi Roseanne,

I haven't studied this very thoroughly, but I couldn't help noticing (what I think is) a misplaced bracket in the CALCTEXT for cam_featrue3.

So in case that's all the problem is, please would you replace the CALCTEXT for cam_featrue3 with this...

   @CALCTEXT(if([cam_3a3b_score]<>"",if([cam_3a3b_score]<"4", "Positive","Negative"),""))

... and see if it fixes the problem?

All the best,
David.


From: redca...@googlegroups.com <redca...@googlegroups.com> on behalf of Rosanne Pogash <rmpo...@gmail.com>
Sent: 27 September 2021 16:13
To: redcap open <redca...@googlegroups.com>
Subject: CALCTEXT issue
 
--
You received this message because you are subscribed to the Google Groups "redcap open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redcap_open/a25e025f-62f5-4cc4-bfb9-09381fcc38f0n%40googlegroups.com.

Rosanne Pogash

unread,
Sep 27, 2021, 7:00:59 PM9/27/21
to redcap open
David,

No, this did not solve the issue in Feature 3 whereby I edit values that make up part of the [cam_feature3] calctext but the text of [cam_feature3] does not change appropriately until I hit one of the radio buttons a second time.

Rosanne

Peter Macisaac (POP)

unread,
Sep 28, 2021, 6:44:03 AM9/28/21
to Rosanne Pogash, redcap open
Rosanne

I uploaded your file using librecalc -  very reliable redcap spreadsheet editor

You have miscellaneous crap characters as shown by the question marks in black diamonds
See attached screen shot




These characters play havoc with redcap reliability (last time I saw them they stuff up a mobile app project no end until we found them)

Do not let Xcel anywhere near your data dictionary

Please find and remove these hidden characters and see if that fixes your problem

regards

Peter MacIsaac
REDCap open member and sys admin








--
You received this message because you are subscribed to the Google Groups "redcap open" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redcap_open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/redcap_open/a25e025f-62f5-4cc4-bfb9-09381fcc38f0n%40googlegroups.com.
<cam_data_dictionary.csv>

David Edwards

unread,
Sep 28, 2021, 7:00:05 AM9/28/21
to Rosanne Pogash, redcap open
Hi Roseanne,

Well it was worth a try and eliminates that as the cause.

I'll prefix this by saying I'm no expert in the use of CALCTEXT and I may be getting out of my depth here - i.e.  it may be worth getting a second opinion on this one...

Looking at it again, [cam_feature3] is dependent on the results of a calculation, [cam_3a3b_score], which in turn is dependent on the result of another calculation [cam_3a_score].
Whereas [cam_feature1] and [cam_feature2] are not dependent on the results of calculations.

Now there's a subtle difference between when calc type fields are calculated versus fields using the @CALCTEXT action tag. It's been a while, but from memory, I think CALCTEXT fields are calculated on page load, whereas calc fields need the form to be saved (or at least something changing on the form once it's loaded).
So that would be my best guess as to why you have to save the form to get a result in [cam_feature3], and why the other 2 work without that.

*If* that is the cause, then here's what I would try to fix it:

  1. Copy your [cam_feature3] CALCTEXT calculation somewhere and save it in case this doesn't work, so you can restore it afterwards.

  2. Instead of referencing the calc type fields in [cam_feature3], replace them with the actual calculations - thus eliminating the difference in when these different types of calculation are triggered.

  3. i.e. replace the CALCTEXT you currently have in [cam_feature3] with this:

  4. @CALCTEXT(if((([cam_3a1]+[cam_3a2]+[cam_3a3]+[cam_3a4])+[cam_3b_score])<>"", if((([cam_3a1]+[cam_3a2]+[cam_3a3]+[cam_3a4])+[cam_3b_score])<"4", "Positive", "Negative"), ""))
  1. Try again and let us know if it fixed the problem.

The inherent problem with this kind of fix is that if you ever change the calculations in [cam_3a_score] or [cam_3a3b_score] you would also have to change them in [cam_feature3] CALCTEXT to match.

Thanks David.



Sent: 27 September 2021 23:00
To: redcap open <redca...@googlegroups.com>
Subject: Re: CALCTEXT issue
 

David Edwards

unread,
Sep 28, 2021, 7:02:15 AM9/28/21
to Peter Macisaac (POP), Rosanne Pogash, redcap open
Hi Roseanne/Peter - Peter replied while I was composing my reply.

So I would try what Peter advises first.
Then if still no joy, try what I suggested.

Thanks,
David.


From: redca...@googlegroups.com <redca...@googlegroups.com> on behalf of Peter Macisaac (POP) <pe...@macisaacinformatics.org>
Sent: 28 September 2021 10:43
To: Rosanne Pogash <rmpo...@gmail.com>
Cc: redcap open <redca...@googlegroups.com>
Subject: Re: CALCTEXT issue
 

Rosanne Pogash

unread,
Sep 28, 2021, 10:27:37 AM9/28/21
to redcap open
Peter and David..

Thank you for your ideas.  

Peter.... thank you for the suggestion.  I didn't need to do that.  I did not manipulate anything using Excel.  I simply created that table using the Rich Text option in REDCap while embedding fields.

David.... You were right about using the calculated fields in the @CALCTEXT function.  I replaced the Feature 3 text with yours.  However, "Negative" was still displaying when all the fields were blank.  Therefore, I edited the text as below and everything is working now. The field is blank when the form is first opened up.  Feature 3 now updates correctly whenever any of the components of the logic changes the score  to < 4 or >= 4.

@CALCTEXT(if((([cam_3a_score])<>"" and [cam_3b_score]<>""), if((([cam_3a1]+[cam_3a2]+[cam_3a3]+[cam_3a4])+[cam_3b_score])<"4", "Positive", "Negative"), ""))

Rosanne
Reply all
Reply to author
Forward
0 new messages