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
8 subscribers
Views
6159 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
CDT With Very Very Many Fields
davids735
over 8 years ago
I'm creating a proof of concept with a CDT containing 1352 Text fields to see if there are practical limitations like lag or database writes failing. I was just wondering if anyone had formulated a script for writing the same value to each and every one of a CDT's fields quickly. For instance a rule that took in the CDT and "Steve" or something like that and made every one of the fields "Steve" without me having to manually insert all 1352 "Steve" strings myself.
OriginalPostID-237167
Discussion posts and replies are publicly visible
0
Aaron Swerdlow-Freed
A Score Level 1
over 8 years ago
If you have a list of the field names, just writing a java app to write the SAIL might be the fastest.
pseudo would be:
for (x, len(list), x++)
{
print "a!save(ri!cdt." + list[x] + ",ri!steve),"
}
Then just copy that into a button or something. You could also easily just make an expression rule with the same concept, this was just an easier example.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mike Schmitt
Certified Lead Developer
over 8 years ago
check out the "updateCdt" function available in the CDT Manipulation plug-in.
Also, it seems like this might be a good use case for the eval() function.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
The attached will take a single instance of a cdt, split it into fields and produce a section containing a text field for each cdt element. You might have to do something fancy to get the saveInto working but it's probably a start.
Credit to Tim Clarke for the original code.
dynamicForm.txt
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Dan Tobias
Appian Employee
over 8 years ago
Use the function update()
It's "hidden" but it works just fine for developing and non-production work.
It takes parameters: cdt, field, and value, in that order.
So you could run this SAIL and update all of your fields:
reduce(
update(_, _, "Steve"),
type!YOUR_CDT,
{"field1", "field2", "field3".... "field1352"}
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
PhilB
A Score Level 1
over 8 years ago
Dan - interesting function, good to know about that one. To extend that example, you could replace the hardcoded array with:
apply(
fn!concat(
"field",
_
),
enumerate(
1352
) + 1
)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
davids735
over 8 years ago
You both are a great help, thank you.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
abhi.jana
Appian Employee
over 8 years ago
I'd recommend using the CDT manipulation plugin rather than any "hidden" product functions since they are not documented and therefore unsupported.
forum.appian.com/.../summary
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel