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
Hi Alastr, Are you looking to know how to perform save in the script task output?
If yes, please see the screenshot all you need to do is save the data part of query entity results[Wrap it inside the expression rule] to the PV of same CDT type[Refer Screenshot ]. If you want to map it to the different CDT structure then you can do it by mapping query results individually to the fields of different CDT
Let me know if anything is unclear.
with the rule that I have put I get a dictionary
with( a!queryEntity( entity: cons!CPRO_CT_DS_docs, query: a!query( filter: a!queryFilter( field: "doc", operator: "=", value: ri!doc ), pagingInfo: a!pagingInfo(1,-1) ) ).dataRule Input Name doc (Text) Expression "[Document: 7945]" Value "[Document: 7945]Now with the value "[Document: 7917]" from the table "docs" It is necessary to recover the "id" associated with that document And entered in the field "idSolic" of the other cdt. but this in a script task
with( a!queryEntity( entity: cons!CPRO_CT_DS_docs, query: a!query( filter: a!queryFilter( field: "doc", operator: "=", value: tointeger(ri!doc) ), pagingInfo: a!pagingInfo(1,-1) ) ).dataHi, Can you please use tointeger() function to get the id? [Use new code]Also when dictionary results mapped with CDT type it will do convrsion automatically.Hope this helps!
it gives me failure.In my table "docs" I haveid doc10 [Document: 7945]Now, with that id "10" that I have associated with that document,
I want to enter it into the id of my other table that also has the doc field
give input as tointeger("[Document: 7945]")
index(index(a!queryEntity(entity: cons!CPRO_CT_DS_docs,query: a!query(filter: a!queryFilter(field: "doc",operator: "=",value:"[Document: 7945]"),pagingInfo: a!pagingInfo(1,-1)) ),"data",{}),"id",null)
I think you need to index id from query entity results that result can be mapped to other cdt column "idSolic"
and what I want is to take the id of the last record in this table and put that id in the other cdt in which only the doc is entered
cdt
CDT DOCSid doc...
8 [Document: 7862]
9 [Document: 7910]
10 [Document: 7945]CDT SOLS
id doc...
null [Document: 7862]
null [Document: 7910]
null [Document: 7945]
You can achieve it by applying sorting and batchsize as 1
index(index(a!queryEntity(entity: cons!CPRO_CT_DS_docs,query: a!query(filter: a!queryFilter(field: "doc",operator: "=",value:"[Document: 7945]"),pagingInfo: a!pagingInfo(startIndex: 1,batchSize: 1,sort:a!sortInfo(field:"id",ascending:false))) ),"data",{}),"id",null)
but I should not put in the value "value:" [Document: 7945] "" but I want to take the document from the last record to go to look at its id and with that id save it in the other cdt