Hi All, I'm getting the following error:
Error Evaluating UI Expression Expression evaluation error in rule 'ctm_reviewissuesform' at function a!formLayout_17r1 [line 16]: Invalid index: Cannot index property 'protocolNum' of type Text into type List of Variant
Note the below code snippet does not match the line numbers mentioned in this error, I just took a piece of the code to display here. The error [line 16] refers to [line 5] below--
The scenario is that I've edited the Label of one Interface to the following:
a!formLayout_17r1( label: if( condition: isnull(ri!step), valueIfTrue: "Review Monitoring Form Issues for " & rule!CTM_getStudyProfileInfoById(ri!CTM_MONITORING_EVENT.studyProfileID).data.protocolNum & " (ID: "& ri!CTM_MONITORING_EVENT.eventID & ")", valueIfFalse: choose(ri!step, "Set Resolution Due Dates & Send Initial Summary to Study Team for "& rule!CTM_getStudyProfileInfoById(ri!CTM_MONITORING_EVENT.studyProfileID).data.protocolNum & " | " & rule!CTM_getRefDataLabelById(local!site.siteName).label & " | " & rule!CTM_displaySubInvestigatorNames(local!studyProfileSite.subInvestigator) &" (ID: "&ri!CTM_MONITORING_EVENT.eventID&")", "Review & Resolve Identified Issues for Protocol " & rule!CTM_getStudyProfileInfoById(ri!CTM_MONITORING_EVENT.studyProfileID).data.protocolNum & " | " & rule!CTM_getRefDataLabelById(local!site.siteName).label & " | " & rule!CTM_displaySubInvestigatorNames(local!studyProfileSite.subInvestigator) &" (ID: "&ri!CTM_MONITORING_EVENT.eventID&")" ) )
I only see this error when running tasks that were initiated PRIOR to this code change (originally it was a generic naming label and ID#) -- I don't know why this error is thrown only in older processes and not the newer ones? What piece of data is missing? I thought at first it was missing something and passing a null value, but clearly the error has more to do with the indexing properties not matching in type, but I'm not sure where to even look to fix.
Thanks
Discussion posts and replies are publicly visible
ou may find some success with casting the result of your query to the correct type. Ex.
cast(typeof(type!YourCDTType()), rule!CTM_getStudyProfileInfoById(ri!CTM_MONITORING_EVENT.studyProfileID).data).protocolNum
I also recommend avoiding dot notation when accessing values ex.
index(cast(typeof(type!YourCDTType()), index(rule!CTM_getStudyProfileInfoById(index(ri!CTM_MONITORING_EVENT, "studyProfileID", null)), "data", {})), "protocolNum", null)
Using index() instead of dot notation will return the third parameter instead of throwing an invalid index error.
Instead of using a loop you can do cast(typeof({type!CDT()), <CDT Variable Multiple>)
Hi Ravi, agreed on the local variable, thanks -- I successfully created the local and called it using the index() which got the form to load - success!
Now I'm facing trouble in the User Input Task naming as I used similar code to display the task name similar to the Interface based on step, so I get this massive error in the task names now:
How do I do something similar to index() but inside of the (notsofriendly) User Input Task Display Name expression editor?? The code looks like this now:
=choose(pv!step,"Set Resolution Due Dates & Send Initial Summary to Study Team for " & rule!CTM_getStudyProfileInfoById(pv!CTM_MONITORING_EVENT.studyProfileID).data.protocolNum & " | " &rule!CTM_getRefDataLabelById(pv!CTM_STUDY_PROFILE_SITE.siteName).label& " | " & rule!CTM_displaySubInvestigatorNames(pv!CTM_STUDY_PROFILE_SITE.subInvestigator) &" (ID: "&pv!CTM_MONITORING_EVENT.eventID&")","Review & Resolve Identified Issues for Protocol " & rule!CTM_getStudyProfileInfoById(pv!CTM_MONITORING_EVENT.studyProfileID).data.protocolNum & " | " &rule!CTM_getRefDataLabelById(pv!CTM_STUDY_PROFILE_SITE.siteName).label& " | " & rule!CTM_displaySubInvestigatorNames(pv!CTM_STUDY_PROFILE_SITE.subInvestigator) &" (ID: "&pv!CTM_MONITORING_EVENT.eventID&")")
Thanks all!