cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
msdejong79
Frequent Visitor

Cannot write record to (Excel) source: wrong data type

Hello experts!

I've started building a PowerApp only a few days ago and am experiencing quite some difficulty. For starters the language settings make it so, that operators are completely different and do not match any of the feedback found on forums. Not sure how much of my issue can be brought back to the language question but it's good to know as you evaluate my question and code.

 

I'm trying to write a record to the External data source which is an Excel file. If I write this:

 

Patch(dataRaw; Defaults(dataRaw); {TeamA1: "test"}) 

 

it will work: the code is accepted. Of course I want it dynamically: the text to be recorded depends on the dropdown values. Drop down is named "1A_1":

 

Patch(dataRaw; Defaults(dataRaw); {TeamA1: '1_A1'.SelectedText}) 

 

Also when I declare a variable, the same error is given. Type argument TeamA1 does not match the expected type Text (translated from Dutch). In the Excel table, I have already changed the format of this particular column to 'Text'.

Attached is the powerapp. The item can be found on Screen 'Tafel1', it is the button upper corner right, to submit data.


Any help is appreciated. Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

@msdejong79 ,

Please listen to @gabibalaban when he refers to SelectedText - it is Deprecated - see this document and your app will stop working sometime in the future if you use it.

Apart from that, this is a simple Variable setting so there are only two issues to look at: -

  • The Items of your Dropdowns 1_A1  and 1_A2 - ensure that the correct output is .Value. I notice the Items of 1_A2 is Spelers - which I assume is a List  - what field are you displaying in it?
  • If you have set the Variables varDDSpeler1_A1 and varDDSpeler1_A2 elsewhere before this as a Record (hence the incompatible types).

You can also refer to both in the OnChange as Self (example)

Set(
   varDDSpeler1_A1,
   Self.Selected.Value
)

 

View solution in original post

11 REPLIES 11
AJ_Z
Memorable Member
Memorable Member

Just checking this is an excel online datasource. And can you attach the blank excel? So I can try use it with the app


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !
msdejong79
Frequent Visitor

Online in the sense of it is pasted in OneDrive. I can attach the file but it won't be the source file, obviously. 

msdejong79
Frequent Visitor

I've tried again, this time with the declared Variable and addition '.Value'. Even though we want Text format which stricly speaking isn't a value (not numeric anyway), this seems to work now. This means I can continue. Thanks for looking into this helper @AJ_Z . I may call upon you again some time in the future 🙂

@msdejong79 

Please do not use anymore SelectedText property as it is declared deprecated over 2 years ago. The correct formula is:

Dropdown.Selected.Value 

or if your items of dropdown is a table it should work :

Dropdown.Selected.DesiredColumnNamefromItems

Hope it helps !

AJ_Z
Memorable Member
Memorable Member

Happy that it has been resolved feel free to reach out in the future 🙂


If you appreciated my comments/responses please be sure to Like/Kudo them it really does make me smile 🙂 !

No that doesn't help me in the slightest 😂

Now it gives me an error notification: incompatible types - contextvariables are now incompatible.

 

msdejong79_0-1638696536320.png

 

Which I interpret as such: it is no longer considered 'Text' type. I do need Text type for this one.

Would appreciate further explanation @gabibalaban 

Thanks!

@msdejong79 ,

You missed .Selected in your formula please check.

Doesn't make a difference:

 

msdejong79_0-1638714144117.png

Also, the modules offered by microsoft use the .SelectedText property:

msdejong79_0-1638720462861.png

From module: Tables and formulas, Exercise - Use collections and manipulate tables.

Helpful resources

Announcements
User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,514)