As subject line states, I have a canvas app with a toggle switch (Toggle1) that I want to Collect() with a button and write the value to a dataverse table column (Col1) which is of type Yes/No
In the button 'OnSelect' field I enter:
`Collect(table, {Col1:Toggle1.Value})`
This returns the error:
"The function Collect has some invalid arguments. Incompatible type. The Col1 column in the data source you're updating expects 'OptionSetValue' and you're using a 'Boolean' type. "
I've scoured the forums to no avail.
Thanks.
Solved! Go to Solution.
If(Toggle1.Value=true, Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.Yes}), Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.No}) )
@mikerosoft_userplease try the following code as given below
Hope this works for you
Please Accept as Solution if it solves your question Or just give it a Thumbs Up if it is helpful because this can help others.
LinkedIn: https://www.linkedin.com/in/manan-malhotra-vfx/
Want to support me! Buy me a Cup of Coffee?
In the button try
If(Toggle1.Value=true,Collect(table, {Col1:choicename.Yes),Collect(table, {Col1:choicename.No))
Choice name can be found in reference to below image example "aaaaaa" in this case
OR it can be found with reference to below image
`
I'm not entirely sure what you mean by choice names. As in use the label under 'Choices'? Note that the real column name is displayed here instead of alias.
If(Toggle1.Value=true, Collect(table, {wasAnxious:Yes.Yes}),Collect(table, {wasAnxious:No.No}));
This still results in an Error.
If(Toggle1.Value=true, Collect(table, {wasAnxious(@table):Yes.Yes}),Collect(table, {wasAnxious(@table):No.No}));
In your case you will see a name in this way "wasAnxious(@table)" where you will get a wasAnxious(@table).yes or wasAnxious(@table).no
Please follow this syntax after using the following above name
If(Toggle1.Value=true,Collect(table, {Col1:choicename.Yes),Collect(table, {Col1:choicename.No))
I appreciate the help but it's just not working for me (totally new to powerapps). To reproduce the example verbatim:
my table is called : records
the column to update: wasAnxious
toggle switch name: Toggle1
And the create statement is placed in a button 'OnSelect' field.
I appreciate the help, and will mark as correct answer if I can get it to work. Thanks again.
Hi,
You say you want to collect the value and write it to a dataverse table. Is there a reason not to just write it to the table?
For a new record, try this is your button's OnSelect: Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.Yes})
To have the value depend on the toggle, you have the solution from @Manan-Malhotra :
If(Toggle1.Value=true, Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.Yes}), Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.No}) )
If(Toggle1.Value=true, Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.Yes}), Patch(records, Defaults(records), {wasAnxious: 'wasAnxious (MyTables)'.No}) )
@mikerosoft_userplease try the following code as given below
Hope this works for you
Please Accept as Solution if it solves your question Or just give it a Thumbs Up if it is helpful because this can help others.
LinkedIn: https://www.linkedin.com/in/manan-malhotra-vfx/
Want to support me! Buy me a Cup of Coffee?
User | Count |
---|---|
255 | |
107 | |
85 | |
51 | |
43 |