cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Morne_Landsberg
Level: Powered On

Help with Dropdown list to Number on Sharepoint

Hi GUYS

 

Hope you can help I am a NOOB

 

I have made a Data sheet that sends data to sharepoint

 

2 of the data cards's is a Dropdown with (none,medium,low) etc... 

 

I have managed to use an if statement to say that IF the selection is "none" it wil write to a field in sharepoint which will then make it a 0

 

My coding is working but for some reason it is not writing anything to my CompLevelScore? I am not sure if it is to many IF statements?

 

Here is the code:

Patch(MITAssessment, Defaults(MITAssessment), {Title:NewTitleText_1.Text, Question:DataCardValue7_1.Text, WhyAreWeAsking:DataCardValue8_1.Text, Importance:DataCardValue9_1.Selected.Value,Finding:DataCardValue10_1.Text, ComplianceLevel:DataCardValue11_1.Selected.Value},If(DataCardValue9_1.Selected.Value="Low",{ImpLevelScore:1},If(DataCardValue9_1.Selected.Value="Medium",{ImpLevelScore:2},If(DataCardValue9_1.Selected.Value="Critical",{ImpLevelScore:3};

If(DataCardValue11_1.Selected.Value="Low",{CompLevelScore:1}, If(DataCardValue11_1.Selected.Value="Medium",{CompLevelScore:2},If(DataCardValue11_1.Selected.Value="Compliant",{CompLevelScore:3},If(DataCardValue11_1.Selected.Value="None",{CompLevelScore:0}))))))))

 

 

THANK YOU



1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Help with Dropdown list to Number on Sharepoint

Hi @Morne_Landsberg

 

I wouldn't suggest using logic at that point and would rather have two labels somewhere on-screen that is using that conditional logic.

So your label1 Text will be:
If(
   DataCardValue9_1.Selected.Value="Low","1",
   DataCardValue9_1.Selected.Value="Medium","2",
   DataCardValue9_1.Selected.Value="Critical","3"
)

 

And your label2 Text would be:

If(
   DataCardValue11_1.Selected.Value="Low","1",
   DataCardValue11_1.Selected.Value="Medium","2",
   DataCardValue11_1.Selected.Value="Compliant","3",
   DataCardValue11_1.Selected.Value="None","0"
)

 

Then your patch statement becomes:

Patch(
   MITAssessment, Defaults(MITAssessment),
   {
      Title:NewTitleText_1.Text,
      Question:DataCardValue7_1.Text,
      WhyAreWeAsking:DataCardValue8_1.Text,
      Importance:DataCardValue9_1.Selected.Value,
      Finding:DataCardValue10_1.Text,
      ComplianceLevel:DataCardValue11_1.Selected.Value,
      ImpLevelScore:Value(label1.Text),
      CompLevelScore:Value(label2.Text)
   }
)

 

Could you try that and let me know how it goes?

 

Thanks,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Help with Dropdown list to Number on Sharepoint

Hi @Morne_Landsberg

 

I wouldn't suggest using logic at that point and would rather have two labels somewhere on-screen that is using that conditional logic.

So your label1 Text will be:
If(
   DataCardValue9_1.Selected.Value="Low","1",
   DataCardValue9_1.Selected.Value="Medium","2",
   DataCardValue9_1.Selected.Value="Critical","3"
)

 

And your label2 Text would be:

If(
   DataCardValue11_1.Selected.Value="Low","1",
   DataCardValue11_1.Selected.Value="Medium","2",
   DataCardValue11_1.Selected.Value="Compliant","3",
   DataCardValue11_1.Selected.Value="None","0"
)

 

Then your patch statement becomes:

Patch(
   MITAssessment, Defaults(MITAssessment),
   {
      Title:NewTitleText_1.Text,
      Question:DataCardValue7_1.Text,
      WhyAreWeAsking:DataCardValue8_1.Text,
      Importance:DataCardValue9_1.Selected.Value,
      Finding:DataCardValue10_1.Text,
      ComplianceLevel:DataCardValue11_1.Selected.Value,
      ImpLevelScore:Value(label1.Text),
      CompLevelScore:Value(label2.Text)
   }
)

 

Could you try that and let me know how it goes?

 

Thanks,

Sancho




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

Highlighted
Morne_Landsberg
Level: Powered On

Re: Help with Dropdown list to Number on Sharepoint

Hi

 

Thanks for all the awesome replies, they decided to leave the project so it was all a waste 😞

Helpful resources

Announcements
thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors
Users online (5,508)