0
votes

I be an beginner. I have a multiselect field in my app. The values of these field I will be save in an table with the foreign keys from an another table.

I have a widget with 3 forms software, commodity and contract. All tables are connection into each other. App maker create in the backend a new table with key from the software table and a key from the commodity.

I don't now how save the values from the multiselect field in table.

I currently read the values from the multiselect and pass them to the fields above.

I have same screenshots:

Frontend:
Pic1-Frontend

OnValuesEdit: Pic2-OnValuesEdit

Edit:

I have a table, Produkt_Commodity in these table are different values. For instance:Biogas, energy flex, energy fixed. The values from these table Produkt_commodity will be selection on the page software. The datasouce of the page is software. Software have a many – many binding to Produkt_Commodity. In the page software with datascource software is a Form with a datascource software: Produkt_commodity(relation). In this form I have a multiselect with the values from product_commodity. These values are not stored because I don't know which property to write in the value field.

multiselction Field: multiselction Field

1
What is your options binding? It is cut off so I'm just wondering what the rest of it is. Also I would suggest reading up on the relations API and how to use bindings to manage relations as described here developers.google.com/appmaker/models/relations#data_binding. Typically for a multiselect widget you would not need any code to manage the relation and also you would not be pushing to the keys array but rather to the items array instead. It seems to me that maybe you created your own table 'Produkt_Commodity' where you are managing your relations? AM manages this table automatically. - Markus Malessa
hi, thank you so much for your help. Product_Commodity is not a relationship table, in this table are values contained they are displayed in the multiselect field. The relations are set up correctly. But are not stored correctly. - WWoman1986
I guess maybe post a bit more detail, because it is hard to tell what you are trying to accomplish then. I am guessing that you have a many-to-many relation between software and commodity, but you don't actually ever say so in your question. What is it that you are actually trying to assign a value to in the Create Produkt_Commodity form? - Markus Malessa
I have a table „Produkt_Commodity“ in these table are differend values. For instance:Biogas, energy flex, e. fixed. The values from these table "Produkt_commodity" will be selection on the page "software". The datasouce of the page is “software”. Software have a many – many binding to "Produkt_Commodity”. In the page software with datascource "software" is a Form with a datascource “software: Produkt_commodity(relation)”. In this form I have a multiselect with the values from “product_commodity”. These values are not stored because I don't know which property to write in the value field. - WWoman1986

1 Answers

0
votes

For starters I would encourage you to check out the documentation here https://developers.google.com/appmaker/models/relations#data_binding and the sample app they mention here.

Now there is a couple of changes you will need to implement. Since your page datasource is 'Software' and your 'Software anlegen' form presumably has a datasource of either 'Software' or 'Inherited: Software' I would encourage you to change the datasource for the 'Create Produkt_Commodity' to 'Inherited: Software' also. Then for your multiselect within 'Create Produkt_Commodity' form have a options binding of @datasources.CommodityP.items and a names binding of @datasources.CommodityP..Name and finally a value binding of @datasource.item.Produkt_Commodity.

Also, I would suggest in your 'Software' datasource setting to prefetch your 'Produkt_Commodity' relation and then also remove the 'Submit' button from the 'Create Produkt_Commodity' form as it is not needed. In fact you could get rid of that entire form and just incorporate your multiselect widget into your 'Software anlegen' form instead with the same bindings I already outlined. Also make sure to remove the onValuesEdit code that you had associated with your multiselect.