a!forEach( items: local!rule, expression:a!gridRowLayout( contents: { a!textField( label: "Username", labelPosition: "ABOVE", value:fv!item.KONE_user_name, saveInto: { a!save(target:fv!item.KONE_user_name,value:save!value), a!save(target:ri!userinputsheet.KONE_user_name,value:save!value), a!save(target:ri!userrole.NAME,value:save!value), a!save(target:ri!userrole.USER_ID,value:a!localVariables(local!value:fv!item.KONE_user_name, a!forEach(items:rule!KONE_Development_Username_UserId(),expression:if(local!value=fv!item.username,fv!item.userid,{})) )), }, refreshAfter: "UNFOCUS", readOnly: true, validations: {} ), a!textField( label: "First Name", labelPosition: "ABOVE", value:fv!item.FIRST_NAME, saveInto: { a!save(target:fv!item.FIRST_NAME,value:save!value), a!save(target:ri!userinputsheet.FIRST_NAME,value:save!value)}, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Last Name", labelPosition: "ABOVE", value:fv!item.LAST_NAME, saveInto: { a!save(target:fv!item.LAST_NAME,value:save!value), a!save(target:ri!userinputsheet.LAST_NAME,value:save!value), }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Email", labelPosition: "ABOVE", value:fv!item.Email, saveInto: { a!save(target:fv!item.Email,value:save!value), a!save(target:ri!userinputsheet.Email, value:save!value), a!save(target:ri!userrole.EMAIL,value:save!value)}, refreshAfter: "UNFOCUS", validations: {} ), a!dropdownField( label: "Role", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:if(isnull(fv!item.Role),"null",fv!item.Role), saveInto:{ a!save(target:fv!item.Role,value:save!value), a!save(target:ri!userinputsheet.Role,value:save!value), a!save( target:ri!userrole.ROLE_ID, value: a!forEach (items:rule!KONE_Development_Role_RoleId(), expression:if(fv!item.Role=ri!userinputsheet.Role,fv!item.Role_Id,{}) )), a!save( target:ri!userrole.ROLE, value: save!value), a!save(target:ri!userrole.PHASE_ID, value:a!forEach (items:rule!KONE_Development_Role_RoleId(), expression:if(fv!item.Role=ri!userinputsheet.Role,fv!item.Role_Id,{}) )) }, validations: {} ), a!dropdownField( label: "Branch", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allBranch), choiceValues:reject(fn!isnull,local!allBranch), value:if(isnull(fv!item.Branch),"null",fv!item.Branch), saveInto:{ a!save(target:fv!item.Branch,value:save!value), a!save(target:ri!userinputsheet.Branch,value:save!value), a!save(target:ri!userrole.BRANCH,value:save!value), a!save(target:ri!userrole.BRANCH_ID, value:a!forEach (items:rule!KONE_Development_Branch_BranchId(), expression:if(fv!item.Branch=ri!userinputsheet.Branch,fv!item.Branch_Id,{}) )) }, validations: {} ), a!dropdownField( label: "Region", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRegion), choiceValues:reject(fn!isnull,local!allRegion), value:fv!item.Region, saveInto:{ a!save(target:fv!item.Region,value:save!value), a!save(target:ri!userinputsheet.Region,value:save!value), a!save(target:ri!userrole.REGION,value:save!value), a!save(target:ri!userrole.REGION_ID, value:a!forEach (items:rule!KONE_Development_Region_RegionId(), expression:if(fv!item.Region=ri!userinputsheet.Region,fv!item.Region_Id,{}) )) }, validations: {} ), a!dropdownField( label: "Manager_role", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allRole), choiceValues:reject(fn!isnull,local!allRole), value:if(isnull(fv!item.Manager_role),"null",fv!item.Manager_role), saveInto:{ a!save(target:fv!item.Manager_role,value:save!value), a!save(target:ri!userinputsheet.Manager_role,value:save!value) }, validations: {} ), a!dropdownField( label: "Language", labelPosition: "ABOVE", choiceLabels:reject(fn!isnull,local!allLanguage), choiceValues:reject(fn!isnull,local!allLanguage), value:if(isnull(fv!item.Language),"null",fv!item.Language), saveInto:{ a!save(target:fv!item.Language,value:save!value), a!save(target:ri!userinputsheet.Language,value:save!value), a!save(target:ri!userrole.LANG_ID, value:a!forEach (items:rule!KONE_Development_Language_LanguageId(), expression:if(fv!item.Language=ri!userinputsheet.Language,fv!item.Language_Id,{}) )) }, validations: {} ), a!textField( label: "CE_LEVEL", labelPosition: "ABOVE", value:fv!item.CE_LEVEL, saveInto: { a!save(target:fv!item.CE_LEVEL,value:save!value), a!save(target:ri!userinputsheet.CE_LEVEL,value:save!value), a!save(target:ri!userrole.LEVEL,value:save!value) }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Telephone Number", labelPosition: "ABOVE", value:fv!item.Telephone_number, saveInto: { a!save(target:fv!item.Telephone_number,value:save!value), a!save(target:ri!userinputsheet.Telephone_number,value:save!value), a!save(target:ri!userrole.TELEPHONE_NUMBER,value:save!value) }, refreshAfter: "UNFOCUS", validations: {} ), a!textField( label: "Exceptional Case Library View Right", labelPosition: "ABOVE", value:fv!item.Exceptional_case_library_view_right, saveInto: { a!save(target:fv!item.Exceptional_case_library_view_right,value:save!value), a!save(target:ri!userinputsheet.Exceptional_case_library_view_right,value:save!value), a!save(target:ri!userrole.IS_EXCEPTION,value:0), a!save(target:ri!userrole.ACTIVE,value:1), a!save(target:ri!userinputsheet.updateTime,value:now()), }, refreshAfter: "UNFOCUS", validations: {} ), a!richTextDisplayField( label:"Update", labelPosition:"ABOVE", value:{ a!richTextIcon( icon:"check", link:a!dynamicLink( saveInto:{ a!writeToMultipleDataStoreEntities( valuesToStore: { a!entityData(entity: cons!KONE_Development_userinputsheet_Constant, data: ri!userinputsheet), } ), } ), linkStyle:"STANDALONE", color:"POSITIVE" ) } ),
Sorry, I used update arrow for icon"check" at end of each data row, I wish to update existing information, however, once i fill blank and click update, it always appear to be a new data row for the new information i fill in text blank which wish to be updated, someone tell me why?
Discussion posts and replies are publicly visible
If you want to update a row it means the data is already present in your database, hence first you need to query the record which you need to update so you get the primary key id for that record, update the record and let the primary key id assigned/unchanged what you get upon query the record. This will update the record instead of inserting a new row.
I use editable grid to read data by using local!rule and fv!item.value shows in each text blank,then value:fv!item.value
saveInto:ri!table.value but it is not work
This is super confusing.
As Ravi said, Appian will insert or update depending on the value of the primary key. If there is not value (null) then it becomes an insert, else an update.
Now you need to find out what you do to all the data in your interface and whether the PK is null or not.
i set the value:fv!item.value saveInto:ri!table.value. I mean if I don't do anything in that text blank(type or click), then the fv!item.value will not be saveinto ri!value, just leave it null.
such as this
a!textField( label: "Username", labelPosition: "ABOVE", value:fv!item.KONE_user_name, saveInto: { a!save(target:ri!userinputsheet.KONE_user_name,value:fv!item.KONE_user_name), a!save(target:ri!userrole.NAME,value:save!value), a!save(target:ri!userrole.USER_ID,value:a!localVariables(local!value:fv!item.KONE_user_name, a!forEach(items:rule!KONE_Development_Username_UserId(),expression:if(local!value=fv!item.username,fv!item.userid,{})) )) }, refreshAfter: "UNFOCUS", readOnly: true, validations: {} ),
I can not really follow ...
A saveInto will only evaluate after the user modifies the value of the field.