Enter a value from one cdt into another and create a script

Hello, 
I'm new to appian and I can not solve a question

I have two tables. The first "request" table has two fields: id (integer), name (text) and document (text). The second table "documentation" also has two fields: iddocum (integer) and docum (text). With a form that has a text field and a field to upload a file, fill both fields and I give the send button. In my database "request" appears an id that is generated only for each shipment you make, the name I have inserted and the document ([Document: 7917]). Also in the other "documentation" table that same one is saved value of the document ([Document: 7917]). Here comes my problem. I want the id generated only from the first table, I can pick it up and save it together with the value of the document at a time. For this last, I have an expression rule that does not work well.
index( index( a! queryEntity ( entity: cons! CPRO_CT_DS_solicitudes, query: a! query ( filter: a! queryFilter ( field: "documentation", operator: "=", value: "[Document: 7945]" ), pagingInfo: a! pagingInfo ( startIndex: 1, batchSize: -1, sort: a! sortInfo ( field: "id", ascending: false ) ) ) ), "data", {} ), "id", null ) I also have a process where I start the form and then with an XOR, I ask: if I have not uploaded a document that finishes my process and if I have uploaded a document, in the script task pick up the id. Do not do this part correctly.

  Discussion posts and replies are publicly visible

Parents
  • Hi Alastr,

    Considering the form values are saved like below:
    Process variables:
    1)request(this will be your request cdt type)
    2)documentation(this will be your documentation cdt type)

    For example,
    pv!request.id-null
    pv!request.name-"test"
    pv!request.document-"7917"

    pv!documentation.id-null

    pv!documentation.iddocum-null

    pv!documentation.document-"7917"

    write the request data using "Write to datastore entity" smart service and save the output from the Write to datastore entity node in your request process variable.It will be like this:

    pv!request.id-1
    pv!request.name:test
    pv!request.document:7917

    Place a script task after the write to datastore entity node and set the pv!request.id value in pv!documentation.iddocum and write the documentation data using another write to datastore entity node


  • There is one wrong thing. After sending the form, when you save the values, in the first cdt "requests" a value is generated for the id (which has increased 1 If more forms are sent. The id field would not be null)

    id name  document
    1 test      [Document: 7910]
    2 test2    [Document: 7917]

    The id with value 1 or 2, I want to take it from the cdt "request" and enter it
    in iddocum of the cdt "documentation". This is what I need to do
    
    My task script would be this one. How should I enter the data in the output node
    of the task script?
Reply
  • There is one wrong thing. After sending the form, when you save the values, in the first cdt "requests" a value is generated for the id (which has increased 1 If more forms are sent. The id field would not be null)

    id name  document
    1 test      [Document: 7910]
    2 test2    [Document: 7917]

    The id with value 1 or 2, I want to take it from the cdt "request" and enter it
    in iddocum of the cdt "documentation". This is what I need to do
    
    My task script would be this one. How should I enter the data in the output node
    of the task script?
Children