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
Hello Alastr,
Do you have the field doc of your CDT is integer? text? document? if the nature of that field is Document I would suggest to use the Document as the type there. if the docume is text that is by you are getting it as "[Document: 123123]"
As explained If you need just to get the last record maybe just sort (using sortInfo object and pass it ascending:false()) and use a pagingInfo ( 1,1)
hope this helps
Jose
Hello,
I do not understand how you want to do what I described. Could you include it in my expression rule?
The doc field of my first cdt "docs" is of text type.My expression rule is:with( a!queryEntity( entity: cons!C_CT_DS_sol, query: a!query( filter: a!queryFilter( field: "doc", operator: "=", value: ri!doc ), pagingInfo: a!pagingInfo(1,1) ) ).data)
if I enter my last value in the documentation field entered into the cdt in the TEST RULE,
[Document:7547], shows "Error at input: documentation" and I do not know why.
That is exactly that is part of the problem the doc field is text, at least if I were to save a document I would use integer or document as type all around when passing the document thru rules, process, cdt
and if I change the "docs" field by integer type, what steps should I follow next?
I am assuming you are developing. And your code and it is not in production. If it is already in prod there are a lot more considerations.
But in development you just open the cdt, change the type of the field. Maybe you might need to update the table as well.
Good, atleast u gave valuable information to him