web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / patch function formula...
Power Apps
Answered

patch function formula help needed

(0) ShareShare
ReportReport
Posted on by 60

I'm trying to have a bunch of text input boxes and drop downs update a spreadsheet. i need them to create a new row of information and then reset to blank on submission, seems simple enough but i keep getting errors and i really need someone to work through this with me.

 

 

Patch(Table1, Defaults(Table1), { DATE: DatePicker1.SelectedDate, NURSERY: Dropdown1.SelectedText, PLOT: TextInput1.Text, SUB_PLOT: TextInput2.Text, HISTORICAL_CROP_TYPE: Dropdown2.SelectedText, COMMENTS: TextInput3.Text, pH: TextInput4.Text, Ca: TextInput5.Text, Mg: TextInput6.Text, P: TextInput7.Text, K: TextInput8.Text, Cu: TextInput9.Text, Mn: TextInput10.Text, Zn: TextInput11.Text, B: TextInput12.Text}); Reset(DatePicker1); Reset(Dropdown1); Reset(TextInput1); Reset(TextInput2); Reset(Dropdown2); Reset(TextInput3); Reset(TextInput4); Reset(TextInput5); Reset(TextInput6); Reset(TextInput7); Reset(TextInput8); Reset(TextInput9); Reset(TextInput10); Reset(TextInput11); Reset(TextInput12); Navigate(SUBMIT_SUCCESS,ScreenTransition.None)

 

Error message:  the type of this argument 'HISTORICAL_CROP_TYPE' does not match the expected type 'text' . Found type 'Record'. 

 

thanks in advance!

 
 
 
 
 
 
Categories:
I have the same question (0)
  • wyotim Profile Picture
    2,545 on at

    Hey @ronanf16, I would suspect the issue is coming from your use of SelectedText without identifying a field. This is likely causing it to use the entire record from the dropdown, not just the selected field that is displayed in the dropdown. Also, I think SelectedText is being depreciated, so you may want to use Selected instead. Maybe try: 

    // Assuming HISTORICAL_CROP_TYPE is the name of the field you are after
    HISTORICAL_CROP_TYPE: Dropdown2.Selected.HISTORICAL_CROP_TYPE


    You may need to do something similar for NURSERY as well as it is using the same format. 

     

    Let me know if that solves the issue or not; I'd be happy to follow up if needed!

  • v-siky-msft Profile Picture
    on at

    Hi @ronanf16 ,

    What is the date type of HISTORICAL_CROP_TYPE field? And what is the Item property of that dropdown?

     

    The SelectedText property which is deprecated will return a record, however HISTORICAL_CROP_TYPE field is needed as a text.

    So you should add a "." behind the Dropdown2.SelectedText to select the fieldname, such as Dropdown2.SelectedText.Value, so that it will return the selected text.

    Note: The SelectedText is deprecated, you'd better to use Selected property. And the field name is up to the Items of drop down, It doesn't have to be the Value, please refer to the formula suggestion. The NURSERY should also be consided!

     

    Patch(Table1, Defaults(Table1), { DATE: DatePicker1.SelectedDate, NURSERY: Dropdown1.Selected, PLOT: TextInput1.Text, SUB_PLOT: TextInput2.Text, HISTORICAL_CROP_TYPE: Dropdown2.Selected.Value, COMMENTS: TextInput3.Text, pH: TextInput4.Text, Ca: TextInput5.Text, Mg: TextInput6.Text, P: TextInput7.Text, K: TextInput8.Text, Cu: TextInput9.Text, Mn: TextInput10.Text, Zn: TextInput11.Text, B: TextInput12.Text}); Reset(DatePicker1); Reset(Dropdown1); Reset(TextInput1); Reset(TextInput2); Reset(Dropdown2); Reset(TextInput3); Reset(TextInput4); Reset(TextInput5); Reset(TextInput6); Reset(TextInput7); Reset(TextInput8); Reset(TextInput9); Reset(TextInput10); Reset(TextInput11); Reset(TextInput12); Navigate(SUBMIT_SUCCESS,ScreenTransition.None)

     

     Hope this can help.

    Best regards,

    Sik

    If my post is helpful for you, please click on “Accept as Solution” to help other members find it more quickly.

     

  • ronanf16 Profile Picture
    60 on at

    thanks for the help guys but this still isn't working however. I have tried all your suggestions but to no avail.

     

    I guess HISTORICAL_CROP_TYPE is text in the datasource but my dropdowns do not pull from the datasource. the  options are simply pulled from the dropdown properties when they are entered between "". I don't know if this makes a difference.

     

     

     

     

     

  • wyotim Profile Picture
    2,545 on at

    @ronanf16 Do you mind sharing what code you have in the dropdown's Items property? And also could you share what error code you are getting after trying those changes? That info would be helpful and appreciated in getting this thing sorted!

  • ronanf16 Profile Picture
    60 on at

    NURSERY = Dropdown1 = ["BALLINTEPLE", "CLONE", "TINAHEALY" ]

    HISTORICAL_CROP_TYPE = Dropdown2 = ["CONIFOR", "BROADLEAF" ]

     

    I have changed things back to the original formula and original error message as I felt what I was changing wasn't solving the issues

  • Verified answer
    wyotim Profile Picture
    2,545 on at

    @ronanf16, given that your dropdowns are hardcoded, I think @v-siky-msft's suggestion of

    HISTORICAL_CROP_TYPE: Dropdown2.Selected.Value

    should solve that issue. "Value" is the default property given to nameless lists (unless you use the Distinct function; then it uses "Result"). You will need to do the same for NURSERY, like so:

    NURSERY: Dropdown1.Selected.Value

     

    If both those columns are text in your spreadsheet, this should do the trick for writing those values. It is possible that there is another issue in your code, so if you could try those two changes and then maybe see what error is showing (if any) I'd be more than happy to follow up!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard