0
votes

[google-app-maker]

New to AppMaker and never done coding before, so please excuse the question if obvious or I'm trying to do the impossible.

App Maker -

I have a page,

on the page is a 'Create' Item form, and then on another panel on same page, a dropdown from another model thats generated from a 'one relation end' and using a none related datasource or model to the model I am updating.

Like me my code is very simple(as learning) Im just trying to update a field within the model the form is creating a new item in with the current dropdown value, that comes from a different datasource and based on a 'one relation end' from two other tables.

Table:

Id | date |  action  | user | note | theValue |
             'did it'                    X

I have applied the code within my 'Submit button' on the form, to keep it very basic.

widget.datasource.item.action = 'did it'; // Works fine
widget.datasource.item.theValue = 
widget.root.descendants.Sites_dropdown.value;  // this fails ( error below )
widget.datasource.createItem();

But I get the following error.

ERROR --

Type mismatch: Cannot set type sites record for property newValue. Type String is expected.
at assets_move.Content.Form1.Form1Footer.Form1SubmitButton.onClick:2:33

I can see by the error, its not passing as a string, not sure if this is because its a dropdown with a different datasource on another panel, or Im using the wrong binding to get the value.

Any help much appreciated.

1

1 Answers

0
votes

The problem is likely that the value binding you have in the property editor of the Sites_dropdown widget is not a string, make sure it is a string binding and it should work. Also, with a binding, you will not need this anymore:

widget.datasource.item.theValue = widget.root.descendants.Sites_dropdown.value;

Since the binding will handle that for you.

You may also have the Options property of the widget set to a record, and thus the value is also a record. Make sure options is also a string and not a record.