as title, how can i add data to multiple table at same time by using a!writeToDataStoreEntity, give me a example code, thank you
Discussion posts and replies are publicly visible
HI
You can write to one Data base table using a!writeToDataStoreEntity() , where as you can use a!writeToMultipleDataStoreEntities() to write data to multiple data base tables
below is an example for the a!writeToMultipleDataStoreEntities()
a!writeToMultipleDataStoreEntities( valuesToStore:{ a!entityData( entity:/* DATA STORE ENTITY*/, data:/* DATA THAT NEED TO BE STORED*/ ), a!entityData( entity:/* DATA STORE ENTITY*/, data:/* DATA THAT NEED TO BE STORED*/ ) })
Else if you are using process model then you can go with the Write to Data Store Entity Smart Service .
docs.appian.com/.../Write_to_Multiple_Data_Store_Entities_Smart_Service.html
Could not display interface. Please check definition and inputs. Interface Definition: Expression evaluation error [evaluation ID = e8134:373fe] : An error occurred while executing a save: Expression evaluation error: You must specify a variable to save into, such as ri!name << fn!sum. Received: Rule or Function Reference.
you way i tried before, but it report with:
Interface Definition: Expression evaluation error: An error occurred while executing a smart service: The list of EntityData passed to the smart service contains entities from different data stores. All entities must belong to the same data store. No values have been written. (APNX-1-4208-001)
The Write to Multiple Data Store Entities Smart Service writes multiple CDT values to multiple entities within the same data store and in your case i am assuming that entities are not belonging to same datastore hence the error. Try moving the entities to same DS or you will have to write 2X using write to data store entity.
would you give a sample?
Please see the screenshot, where multiple entities are inside "DU Data Store" and Write to Multiple Data Store Entities should be used to write data among the entities present under "DU Data Store" .
my KONE_Development_userrole and KONE_Development_userinputsheet are all under my Data Store
if I use two buttons apply a!writetoDataEntity then both table work
Is it possible to post screenshot of your DS?
you mean both are under the same data store right? If one data store has both in it, then your a!writetomultipledatastoreentity() should work fine.
If i write independently by apply two buttons, then both work fine