Process Variable not getting assigned with DSE

I have a rule to fetch DSE from database. Debugged and works fine.

In my process model, I'm using pkId to lookup data using my rule and then assigning it to a process variable. Unfortunately my process variable is not getting assigned. When I debug the process, I don't see any errors and I've double checked my rule for fetching data and that I'm passing id correctly.

On the Data Output tab of my script task I'm calling the rule - rule!GetDataById(pv!myId) with a Custom Output. myId is populated with value e.g. 4, and I see it when I debug

I'm storing the results in process variable for my entity. However, after I let the script task finish and check my process variables, my entity object is empty.

This should just work :-( 

What obvious thing could I be missing?

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    in reply to appianfreak

    To get the data from the data subset, you add ".data" either after the query entity expression, or after the expression rule where you call it.  Note that I talked about this and also put it into one of my more recent code examples above.

    Appian doesn't give an error because it freely allows types to be cast as other types, and it has no inherent way of knowing whether you're trying to do a valid typecasting or not.

  • Okay, forgive me but that seems a bit lame. Casting a "Date" to a "Text" or vice versa I can understand. Date can be converted to Text with a tostring operation. Text can be converted to Date assuming the Text carried date in some valid format, e.g. MM/dd/yyyy.

    On what planet would a DataSet with multiple attributes when cast to a type of CDT not throw error? It would be one thing if it actually worked, because Appian would smartly assume assignment is to a CDT so let's see if "data" attribute of the DataSet is of that type. But it didn't do that. which is fine, but then not throwing error?

    I may be new to Appian, but I am finding it very hard to buy this logic. If there's some article explaining how Appian implemented casting behavior I would appreciate it. Else I'm going to have to keep writing complicated SAIL expressions. And then "low code" goes out the window.

  • 0
    Certified Lead Developer
    in reply to appianfreak

    Not sure what to tell ya then.  Type casting will attempt to work between any two complex types as far as I know and will use any fields named the same.  Particularly because it would let me cast a type containing "name", "id" and a hundred other fields, for example into a special CDT containing just "name" and "id".  But if there are no common properties between the two types, then the resulting cast operation will result in blank data, such as what you were seeing.

  • Okay, the definition of casting then is "if I want to assign two CDTs to each other and they contain same properties, it is convenient". It then also explains why Appian didn't throw an error. VERY important learning for me. I thank you again for your patience and persistence with me.

  • 0
    Certified Lead Developer
    in reply to appianfreak

    No prob - sorry if it's a little frustrating at certain points, I've been there.