cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Saving data to Sharepoint List - Trouble with dropdown

Hello,

 

I am trying without success to save data from my app to a Sharepoint list called tblDysf containing columns  : dysEmpEmail, dysAffaireNum, dysNature, dysClassification, dysDescription, dysMesure, dysAction

 

Below is my EditScreen1

jouclar_0-1630565080450.png

 

Data in "Affaire N°" comes from a table called tblAffaire

Data in "Nature" comes from a table called tblNature

Data in "Classification" comes from a table called tblClass

 

When pressing validate :

 

1 - i tried :

SubmitForm(EditForm1) but instead of saving data from the three dropdowns to my SP List it save 50 in the corresponding columns

 

2 - Then i tried :

 

Patch(tblDysf; Defaults(tblDysf); {dysEmpEmail:txtEmail.Text; dysAffaireNum:cboAffaireNum.Selected; dysNature: ""; dysClassification: ""; dysDescription:txtDescription.Text; dysMesure:txtMesure.Text; dysAction:txtAction.Text})

 

but i  have an error message saying that dysAffaireNum is waiting for a Type text data and cboAffaireNum.Selected is of Record type.

 

I can't find a way out

 

Thanks for your help

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

@WarrenBelz 

 

I made it work with the following code

Patch(
    tblDysf;
    Defaults(tblDysf);
    {
        dysEmpEmail: txtEmail.Text;
        dysAffaireNum: cboAffaireNum.SelectedText.Value;
        dysNature: cboNature.SelectedText.Value;
        dysClassification:ddClassification.SelectedText.Value;
        dysDescription: txtDescription.Text;
        dysMesure: txtMesure.Text;
        dysAction: txtAction.Text
    }
)

 

thanks for your help

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Change the line to this

dysAffaireNum:Value(cboAffaireNum.Selected.xxxx);

where xxxx is the valid output of the combo box (Value / Result / Field Name)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

 

DavidZoon
Resolver III
Resolver III

Hello, you can try :

- change the date type of column "dysAffaireNum " in your sharepoint list to "Number"

or 

- change "cboAffaireNum.Selected" to "cboAffaireNum.Selected.Value (or result)" or Text(cboAffaireNum.Selected) in your onselected property of "Validate" button

 

 

Anonymous
Not applicable

Hello WarenBelz and thanks for your reply.

 

I changed to 

 

dysAffaireNum:Value(cboAffaireNum.Selected.FieldName)

 

with FieldName been the field from tblAffaire which gave

 

dysAffaireNum:Value(cboAffaireNum.Selected.affnum)

 

 i don't have error messages in the power app formula any more however the data entered in power app is not saved in the Sharepoint List see below (ID=8) in yellow it says that the field is required.

jouclar_0-1630568750030.png

 

Thanks

 

@Anonymous ,

Can you please confirm that the three fields are numeric - if so

Patch(
   tblDysf; 
   Defaults(tblDysf); 
   {
      dysEmpEmail:txtEmail.Text; 
      dysAffaireNum:Value(cboAffaireNum.Selected.affnum); 
      dysNature:0; 
      dysClassification:0; 
      dysDescription:txtDescription.Text; 
      dysMesure:txtMesure.Text; 
      dysAction:txtAction.Text
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

@WarrenBelz 

 

No in my Sharepoint List the three fields are line of Texte

@Anonymous ,

Then the problem you have is that they seem to be required fields but you are patching a blank string "" into them. You need to either remove the compulsory requirement or put in a value. Also disregard the Value() function as it is not needed.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Anonymous
Not applicable

@WarrenBelz 

 

I made it work with the following code

Patch(
    tblDysf;
    Defaults(tblDysf);
    {
        dysEmpEmail: txtEmail.Text;
        dysAffaireNum: cboAffaireNum.SelectedText.Value;
        dysNature: cboNature.SelectedText.Value;
        dysClassification:ddClassification.SelectedText.Value;
        dysDescription: txtDescription.Text;
        dysMesure: txtMesure.Text;
        dysAction: txtAction.Text
    }
)

 

thanks for your help

@Anonymous ,

That is pretty much what I said - except you need to use Selected rather than SelectedText which is deprecated

Patch(
    tblDysf;
    Defaults(tblDysf);
    {
        dysEmpEmail: txtEmail.Text;
        dysAffaireNum: cboAffaireNum.Selected.Value;
        dysNature: cboNature.Selected.Value;
        dysClassification:ddClassification.Selected.Value;
        dysDescription: txtDescription.Text;
        dysMesure: txtMesure.Text;
        dysAction: txtAction.Text
    }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (2,129)