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
6 replies
Subscribers
8 subscribers
Views
2142 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
User Interface
Hi - While changing value using a!save(), I see different output for a!buttonWid
rajeshs
over 8 years ago
Hi - While changing value using a!save(), I see different output for a!buttonWidget() and a!buttonWidgetSubmit(). Isn't it a weird behaviour? But, I am facing this issue. itemsCart is an array of defined CDT where vehicle is a field. When I code inside a!buttonWidgetSubmit() then value is coming as repeated (which is equal to number of records in itemsCart). But, I am getting correctly when I put this code inside a!buttonWidget(). Please find the attached code. I have given sample value as well. Please share your thought. Thanks.
Code.txt
OriginalPostID-167232
OriginalPostID-167232
Discussion posts and replies are publicly visible
Parents
0
jamesm90
over 8 years ago
I'm not seeing different behavior when I try your code, Rajesh. I used your sample values for the rule input, and first tried to execute the button, which broke. This is because we are trying to save one element into an array of elements at the index vehicle. If we think of each cdt as a box with different sections (vehicle would be a section), with the save written as a!save(ri!itemsCart.vehicle, "91524"), we are saying to store "91524" into the section vehicle, but we have two boxes, and we don't know into which box to update the section. I would suggest keeping a local index variable to keep up with which box to update, so your a!save is a!save(ri!itemsCart[local!index].vehicle, "91524"). I know this doesn't directly address your question, but I think you may be seeing different output because your array size may be different between the time you use buttonWidget and buttonWidgetSubmit. To confirm, try switching their positions/using them in the opposite order. a!save should work identically for both button types, and without seeing the full implementation where your weird behavior is happening, my best guess is that your array changes between use of the buttons, so your target location is different, and the save acts as it should, but not as expect, as the target data is different from expected.
Hope that helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
jamesm90
over 8 years ago
I'm not seeing different behavior when I try your code, Rajesh. I used your sample values for the rule input, and first tried to execute the button, which broke. This is because we are trying to save one element into an array of elements at the index vehicle. If we think of each cdt as a box with different sections (vehicle would be a section), with the save written as a!save(ri!itemsCart.vehicle, "91524"), we are saying to store "91524" into the section vehicle, but we have two boxes, and we don't know into which box to update the section. I would suggest keeping a local index variable to keep up with which box to update, so your a!save is a!save(ri!itemsCart[local!index].vehicle, "91524"). I know this doesn't directly address your question, but I think you may be seeing different output because your array size may be different between the time you use buttonWidget and buttonWidgetSubmit. To confirm, try switching their positions/using them in the opposite order. a!save should work identically for both button types, and without seeing the full implementation where your weird behavior is happening, my best guess is that your array changes between use of the buttons, so your target location is different, and the save acts as it should, but not as expect, as the target data is different from expected.
Hope that helps.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data