can anyone please give suggestion how to resolve this error ?
Discussion posts and replies are publicly visible
Hey, looks like the rule mentioned in line 26 is calling another rule within it, namely - cdm2_gettimeentrycdtfielddiff. Open the rule mentioned in line 16 and within that whichever line you are calling rule cdm2_gettimeentrycdtfielddiff, check the and() where you are trying to compare variables. In that one would be an integer and another might be a local variable. Just wrap that local variable in a tointeger(). That should help! If not advice you to paste the screenshot of the rule cdm2_gettimeentrycdtfielddiff as called from within the rule timeEntryDetailsForActivityHistory!
Hi Jyoti,
The cdm2_gettimeentrycdtfielddiff() expression is being called from cdm2_timeentrydetailsforactivityhistory() and the values being used by the cdm2_gettimeentrycdtfielddiff() expression are the types of Number and List.
But the values should be in the type of Number to do the successful comparison. That is what the error says.
Check the parameter values and properly index and cast the value to the Number type if needed. Then the issue will get solved.Thanks
Hii Harsha,
TimeentryDetailsForActivityHistory:
and cdm2_gettimeentrycdtfielddiff
Hii karthi,
can you please help me out where I missed
In your second rule where you are checking the time entry cdt field difference, add a typecasting logic so that both the values in comparison are of same type.
eg. value1=value2 can be replaced as cast(typeof(value2),value1)=value2
In your case value1 i.e. the old record might be null and thus when you are trying to compare that to value 2, having an integer field in it casting error is coming. By using cast() you can make both the values of the same type so that comparison can happen.
Hi Harsha,
Thank you for your response. I am new to Appian Developing so I am trying to understand where i can apply typecasting. could you please help me for this.
Use in line 6 of your rule cdm2_gettimeentrycdtfielddiff where you have condition and(index(oldCDTentry...)=index(newCDTEntry...)
try replacing that with
and(cast(typeof(index(newCDTEntry,ri!fields[ri!index],{})),index(oldCDTentry...))=index(newCDTEntry...)
Is still gives error . I am insert full code below .please help me out.
if( and ( /*To catch lists of values*/ index(ri!oldTimeEntryCDT, ri!fields[ri!index], {}) = index(ri!newTimeEntryCDT, ri!fields[ri!index], {}) ), ri!currentString, concat( ri!currentString, if( or( isnull(index(ri!oldTimeEntryCDT, ri!fields[ri!index], {})), isnull(index(index(ri!oldTimeEntryCDT, ri!fields[ri!index], {}), "value", {})) ), /*If there was no old field, just show current value*/ if( /*Nested CDT lookup fields have "selection" in their field type*/ search("SELECT", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & joinarray(index(index(ri!newTimeEntryCDT,ri!fields[ri!index],{}), "value", {}) & char(10), ", "), if( /*Record fields can't display their title for security reasons*/ search("record", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & " record value selected" & char(10), if( /*Since paragraph fields can contain long values, only show the first 200 chars*/ search("PARAGRAPH_REFERENCE", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & left(index(index(ri!newTimeEntryCDT, ri!fields[ri!index], {}), "value", {}), 200) & char(10), if( /*Certain older paragraph fields are direct fields of the main CDT, instead of nested children,* *so we don't have to index into their value field.*/ search("PARAGRAPH", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & left(index(ri!newTimeEntryCDT, ri!fields[ri!index], {}), 200) & char(10), /*For primitive fields (text, date, number) just read out the value*/ ri!fieldNames[ri!index] & ": " & index(ri!newTimeEntryCDT, ri!fields[ri!index], {}) & char(10) ) ) ) ), /*Otherwise, show old and new values*/ if( /*Nested CDT lookup fields have "selection" in their field type*/ search("SELECT", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & joinarray(index(index(ri!oldTimeEntryCDT,ri!fields[ri!index],{}), "value", {}), ", ") & " ➝ " & joinarray(index(index(ri!newTimeEntryCDT,ri!fields[ri!index],{}), "value", {}), ", ") & char(10), if( /* Record fields can't display their title for security reasons */ search("record", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & " record value changed" & char(10), if( /*Since paragraph fields can contain long values, only show the first 200 chars*/ search("PARAGRAPH_REFERENCE", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & left(index(index(ri!oldTimeEntryCDT, ri!fields[ri!index], {}), "value", {}), 200) & " ➝ " & left(index(index(ri!newTimeEntryCDT, ri!fields[ri!index], {}), "value", {}), 200) & char(10), if( /*Certain older paragraph fields are direct fields of the main CDT, instead of nested children,* *so we don't have to index into their value field.*/ search("PARAGRAPH", ri!fieldTypes[ri!index]), ri!fieldNames[ri!index] & ": " & left(index(ri!oldTimeEntryCDT, ri!fields[ri!index], {}), 200) & " ➝ " & left(index(ri!newTimeEntryCDT, ri!fields[ri!index], {}), 200) & char(10), /*For primitive fields (text, date, number) just read out the value*/ ri!fieldNames[ri!index] & ": " & index(ri!oldTimeEntryCDT, ri!fields[ri!index], {}) & " ➝ " & index(ri!newTimeEntryCDT, ri!fields[ri!index], {}) & char(10) ) ) ) ) ) ) )
Just replace the code from line 2-6 as below and see if it resolves the issue.
and ( /*To catch lists of values*/ cast(typeof(index(ri!newTimeEntryCDT, ri!fields[ri!index], {})), index(ri!oldTimeEntryCDT, ri!fields[ri!index], {})) = index(ri!newTimeEntryCDT, ri!fields[ri!index], {}) )
Thank you so much for your response. its working fine now.