Cast error

Hi All -- I'm stuck trying to get a 3rd CDT to pull into my interface using a query rule that has an input from a local variable... here is the error: 

load(
  
  local!ResolveIsssuesProcessId: rule!CTM_getAllResolveMonitoringFormIssuesProcessIdsByEventId(ri!monitoringEvent.eventID),
  local!formID: rule!CTM_getMonitoringFormByEventID(ri!monitoringEvent.eventID),
  local!formQuestions: rule!CTM_getFormQuestionDetailsByFormID(local!formID),

These are my local variables and here is the query rule that's throwing the error:

In the interface I am trying to save the local!formQuestions into a CDT as an array....why does it think I want to save it as an integer?? 

Instead of using a query rule to pass into the local!formQuestions I also tried an Expression rule that actually returns all the CTD's data but it is also an array of data which doesn't like being saved into the local, I get the same cast error. 

 

Thanks for any help!

  Discussion posts and replies are publicly visible

Parents
  • Hi Sarah,

    It's looks like your passing dictionary insted of id. Try the following code:

    load(

    local!ResolveIsssuesProcessId: rule!CTM_getAllResolveMonitoringFormIssuesProcessIdsByEventId(ri!monitoringEvent.eventID),
    local!formID: rule!CTM_getMonitoringFormByEventID(ri!monitoringEvent.eventID).data,
    local!id: tointeger(index(local!formID, "formID",{})),
    local!formQuestions: rule!CTM_getFormQuestionDetailsByFormID(local!id),
    )

    if you have list of id's use a!foreach to retrive all form question s for all id's

    load(
    local!ResolveIsssuesProcessId: rule!CTM_getAllResolveMonitoringFormIssuesProcessIdsByEventId(ri!monitoringEvent.eventID),
    local!formID: rule!CTM_getMonitoringFormByEventID(ri!monitoringEvent.eventID).data,
    local!id: tointeger(index(local!formID, "formID",{})),
    local!formQuestions: a!foreach(
    items: local!id,
    expression: rule!CTM_getFormQuestionDetailsByFormID(fv!item)
    )
    )
  • Hi nareshc647 , so actually I may only need the formID to pass into that CDT, since ultimately what I am trying to do is have a unique Identifier in my Delete from Datastore node, but I tried the following and it's not deleting the associated lines from my CMT_FORM_QUESTIONS data entity like I would imagine per this expression:

    This configuration I would expect to take any FormID's with the value passed in from the form, and delete the associated lines from the CTM_FORM_QUESTIONS table, right? Am I missing something else? 

  • 0
    A Score Level 2
    in reply to Sarah K.
    your tring to save only ID into CTM_FORM_QUESTIONS_DSE. Insted of indexing the id use pv!formID process varibel in your identifier.

    {entity: cons!CTM_FORM_QUESTIONS_DSE, identifiers: pv!formID}
  • 0
    A Score Level 2
    in reply to nareshc647
    sorry i wrongly understand your question. Try with this

    { entity: cons!CTM_FORM_QUESTIONS_DSE, Identifiers: index( pv!formID, "formquestionID",{})} to delete appriopriate column in table
  • Thanks again for the help, -- if anyone was interested in the solution, I ended up passing in a different CDT (using the same method as described above with the foreach() statement in the local variable) and was able to save that into my data identifiers for the delete smart service node to accomplish my end goal. Took a lot of debugging but it works!
Reply Children
No Data