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
3 replies
Subscribers
7 subscribers
Views
6027 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
AI and Rules
Update data to DB
andrin
over 7 years ago
Hi,
I'm having problem with scripting for updating value to DB,
I have and object with below structure
Client(
IdAccess,
PhoneNo,
Email,
Password
)
How to manipulate and object from query below for instance to update an email address to another value from "http!request.queryParameters.email"? I need this for saving it to DB! or any simple way to do only for updating field?
local!clientAccess: a!queryEntity(
entity: cons!ITR_CONS_Client,
query:
a!query(
logicalExpression:a!queryLogicalExpression(
operator:"AND",
filters:{
a!queryFilter(
field: "PhoneNo",
operator: "=",
value:http!request.queryParameters.userId
),
a!queryFilter(
field: "Password",
operator: "=",
value:http!request.queryParameters.oldPassword
)
}
),
pagingInfo: a!pagingInfo(
startIndex: 1,
batchSize: 50
)
)
).data
OriginalPostID-269252
Discussion posts and replies are publicly visible
0
arunkumarc
over 7 years ago
queryEntity() will be useful only when you just want to retrieve data by filters or aggregation value of DB data. if you want to update some fields in DB you could approach smart service called "Write to Data Store Entity" under Data services.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
marcoc918
A Score Level 1
over 7 years ago
If you want to directly update the data on a Sail interface search for a!writeToDataStoreEntity
forum.appian.com/.../Write_to_Data_Store_Entity_Smart_Service.html
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
andrin
over 7 years ago
Hi,
Thanks for replying, I'm able update using below script:
a!writeToDataStoreEntity(
dataStoreEntity: cons!ITR_CONS_ClientAccess,
valueToStore: {
IdAccess:local!clientAccess.IdAccess,
PhoneNo:local!clientAccess.PhoneNo,
Email:http!request.queryParameters.Email,
Password:local!clientAccess.newPassword
}
,
onSuccess: a!httpResponse(
statusCode: 200,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "success",
message: ""
}
)
),
onError: a!httpResponse(
statusCode: 500,
headers: {
a!httpHeader(name: "Content-Type", value: "application/json")
},
body: a!toJson(
{
status : "error",
message: "There was an error writing to the data store"
}
)
)
)
Is there any simple way to update only certain column (Email column), no need to define all the column?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel