Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
7 replies
Subscribers
6 subscribers
Views
2958 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Process
I have a process variable CDT which has following in it: [docTitile=ABC, do
gaurava322
over 8 years ago
I have a process variable CDT which has following in it:
[docTitile=ABC, docUpload=, docName=Account, docCategory=Test1, docType=Test3, dateIssued=5/5/2016, status=Completed]
[docTitile=DEF, docUpload=Mandatory, docName=Cheque, docCategory=Test2, docType=Test4, dateIssued=5/5/2016, status=Pending]
[docTitile=DEF, docUpload=, docName=Fee, docCategory=Test5, docType=Test6, dateIssued=5/5/2016, status=Pending]
I need to update the rows where column "docUpload" is blank and need to update it with value "Optional". Is this can be achieved by script task. If yes, please provide your suggestions.
OriginalPostID-212735
OriginalPostID-212735
Discussion posts and replies are publicly visible
0
sanjays0006
over 8 years ago
UpdateCDT Function will solve this usecase.
In the script, write something like below:
apply(
updatecdt(
cdt:_,
fieldsAndValues: {<Fieldname>: <New field value>}
),
YourInputCDT
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
gaurava322
over 8 years ago
Thanks Sanjay, I need to only update those records where the ****_cdt.docUpload is blank. This would update all the records with new field value.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sanjays0006
over 8 years ago
Gaurav, you can add a condition to check and then only update the CDT. Else you can write a condition not to update them.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
madhanka
A Score Level 1
over 8 years ago
You can create a rule which checks the field you want to update for blank and if blank update the field to "Optional", else return the existing value. Then call this rule using the apply function and pass all the PVs in it.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sagarl511
A Score Level 2
over 8 years ago
Another way you could do is to create a rule using type!cdt() and create the object as required on the fly by using apply loop on existing cdt. In the rule you create you can have as many conditions and formatting as possible on all the fields.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
vimalkumars
Certified Lead Developer
over 8 years ago
You can also identify indices of the blank values and then update the values in that indices by using the below expression
To find indices:
wherecontains(tostring(null),touniformstring(index(YourCDTVariable,"docUpload", {})))
To update:
updatearray(index(local!a,"docUpload", {}),local!emptyindices,"Optional"))
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Vinod Bongoni
Certified Lead Developer
over 8 years ago
Pull out "docUpload" array from pv!cdtVariable(i.e., pv!cdtVariable.docUpload) and update array with "Optional" where the value is empty and then save this array into pv!cdtVariable in script task outputs
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel