Process Model

Hi All,

Please help me with the below query.

1) created the variables in the start node and updating the data to DB by uing write to data store entity and it successfully creating the lines items in DB

now, we want the update the values through process model which is already present in the DB.

thanks in advance.

  Discussion posts and replies are publicly visible

  • 0
    Certified Associate Developer

    Hi said,

    On Write to data store smart service you can map output stored values to your process variable to see updated values  or new entry


    So it will get the data back from DB with primary key, now you can update values again and update in DB or can use further in PM

  • 0
    Certified Lead Developer

    So, you know you can Write INSERT statements to DB.  That happens when you either don't provide an ID, or one like -1, or the ID you provide doesn't correspond with an existing row.  If the ID DOES map to an existing row, Appian automatically converts to an UPDATE statement.

    Whether it's INSERT or UPDATE is determined at runtime on a row-by-row basis.  You want this data in that row, you got it!

    This does present a challenge for how to force Appian to pick either only Insert or only Update.  If you need to UPDATE, you have to be absolutely certain you have the row ID.  If you want to make sure you do INSERTs, you have to be absolutely certain you do NOT have the row ID.

  • 0
    Certified Associate Developer
    in reply to Dave Lewis

    Yeah if you want to make new entry always, you can ignore output mapping for stored values. Then it will make new entry always.
    Suppose you feel like once inserted an entry and needs to update same entry further in process then take store output mapping to process variable. so next time when you write data to DB it will update.

    So always for update or delete it will expect identifier

  • Hi said0002,

    Hope this might be helpful,

    1.  Create a Query rule , Query the table and get the data , while querying the data base table make sure that you give the "batchSize" of the "pagingInfo"  as "1" so that it will return only one row of data , user index function so that the output will in the form of "data" but not a DataSubset

    2. Take a rule input to filter the data  (take a filed that is unique in the Database table so that u can fetch details for that particular row in database,  for example  :  "id" and the data type as Number (Integer), here consider the Id as the primary key of the Database table )

    3. User a query filter and filter the data (for example  : "id" , test the query by passing the "id" in the rule input, if the "id" exits you can see the data, as we have taken the batchSize as "1" we would get only row of data )

    4. Create a Process model , create process variables (like id, the CDT and other variables) that are required

    5. Take a Script task , in the output of the DATA , create a new custom output and call the above Query rule and pass the process variable to the query rule input (for example  : pv!id , where id is a process variable)

    6. Store the output of the query in a process variable (the data type of the process variable should be the same as the output of the query ,if you are using a CDT, then is data type of the process variable should be the same)

    7. Create an Interface , a rule input (same data type as used in the process model like if you are using a CDT , create a rule input with the data type as CDT) in the interface and use all the components to display the data ( like if you have a "Name" filed you can use a text field to display the data , so that you can edit it  and like wise for the rest of the fields)

    8. Call the above created Interface in the User Input Task of the process model and rule inputs of the Interface will be mapped with the same data type process variable, pass the variable ( the same variable that you have used for storing the query output ) to the value of the interface and save the same in the saveInto

    9. A write to Data Store Entity smart service after the User Input Task and pass all the necessary data input and output of the node (write to Data Store Entity)

    10 . The row in the database will be Altered with the updated data

    NOTE :

    1. You should pass value to the process variable that you are using to filter the Query (for example : "id", we have pass a value to the field "id" so the I can fetch the data from the query )

    2. Use Activity Chaining where ever necessary

    Below is a reference Image of the Process Model

    Reference Image