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

Powerapps forms - fields copying to new form issue

Hi,

 

I have an issue this afternoon that is bugging me.

 

I have a Powerapp with three forms, one collects inial data, and then depending on whether it is an accident or near miss (selected from a drop down) and on the dropdown selected it gow to one or the other. For the tests I have just concentrated on Accident. When passed to the second screen I want the fields the user has already filled in to show their contents.

 

According to threads I could set a variable in the onselect for the drop down and reference it on the next form. This did not work.

 

So I tried a variation of something else - I took the drop down:

 

aCapture1.JPG

On onselect I wanted the info so far to be written to the Sharepoint list, so we then have an ID for the record, and then I want to copy the ID to be copied to variable   (Ithe SET was orifinally before the IF statement, but I tried shifting it during investigation:

 

aCapture2.JPG

 

The code:

 

SubmitForm(Form1_1); If(DataCardValue17.Selected.Value = "Accident" , Set (IDLookup, 'HandS Test 1.0'.ID); Navigate(Incident_Accident, ScreenTransition.Fade)); If(DataCardValue17.Selected.Value = "NearMiss" , Navigate(Incident_Near_Miss, ScreenTransition.Fade))

 

Now in the 'Accident Form' I wanted to set up a Lookup in the Form Item field:

 

aCapture3.JPG

 

 

 

As you see I have an error - It is Invalid Argument Type.

 

I cannot get rid of it. I cannot even put it in a label to see what is getting sent. Of course the form does not work when I select Addicent:

 

 

aCapture4.JPG

 

The theory does work because if I replace the variable with a row ID from the sharepoint list, it displays the record info:

 

 

aCapture4a.JPG

 

aCapture5.JPG

 

 

So My problem must be in the Set statement.

 

Can anyone advise please (or give me another Noddy way to populate my secondary screens)

 

Cheers,

 

Andy Chisholm

 

 

 

 

 

 

 

 

 

 

 

2 REPLIES 2
Super User
Super User

Re: Powerapps forms - fields copying to new form issue

@AndyC

 

can you try changing the order of statements and check -

 

If(DataCardValue17.Selected.Value = "Accident" , Set (IDLookup, 'HandS Test 1.0'.ID); SubmitForm(Form1_1); Navigate(Incident_Accident, ScreenTransition.Fade)); If(DataCardValue17.Selected.Value = "NearMiss" , Navigate(Incident_Near_Miss, ScreenTransition.Fade))

 

The possible reason could be that as you are submitting the form first, it might be resetting the values and that's why I am suggesting the above.

 

let me know.


Vivek Bavishi aka That API Guy
PowerApps and Flow MVP
Blog | Twitter | YouTube | Community Profile | GitHub



If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Microsoft Employee

Re: Powerapps forms - fields copying to new form issue

Hey AndyC,

 

  I've read over your post a couple of times and I think I can help you out. Please let me know if I've misunderstood the needs of your application.

 

  While you could take the partial input and save it to an entry remotely, I don't think that's the best solution. First, it's going to cause additional network roundtrips, which will affect the performance of your app. Second, with that implentation, it's possible for users to end up generating incomplete entries in your Sharepoint list.

 

  I mocked up a simple app that I think has the relevant functionality you're looking for. It has two screens, I'll go over a brief summary of it now:

 

  First Screen: "Initial_Input_Screen"

    Controls:

      TextInput: "Initial_Name_Input"

        HintText:

"Enter your name..."

        OnChange: 

Set(tempName, Initial_Name_Input.Text)

 

      DropDown: "Initial_Name_Input"

        Items:

["", "Accident", "Near Miss"]

        OnChange:

Set(tempType, Initial_Type_Input.Selected.Value);Navigate(Accident_Input_Screen,ScreenTransition.None)

 

 

  Second Screen: "Accident_Input_Screen"

    Controls:

      TextInput: "Accident_Name_Input"

        Default:

tempName

 

      DropDown: "Accident_Type_Input"

        Default:

tempType

 

Summary: On our first screen, "Initial_Input_Screen", we've got a pair of inputs, one for the user's name and then another for the type of incident being reported. For each of these controls, whenever they change (captured using their "OnChange" property), we store that value in a corresponding variable (either tempName or tempType). Additionally, the Initial_Type_Input's "OnChange" property navigates us to the next screen.

 

The next screen, "Accident_Input_Screen", is actually a copy of "Initial_Input_Screen" except for the changes made to each control's "Default" property. With this setup, when we navigate from "Initial_Input_Screen" to "Accident_Input_Screen", the second screen's controls will already be populated with the input from the first screen.

 

From here, we could extend functionality by adding additional, accident-specific controls to the second screen. At the bottom of this page, you could also add a button to submit the now complete entry to your Sharepoint list.

 

After that, you could go back and create a third screen to handle your "Near Miss" incidents. At that point, you would need to modify the logic in "Initial_Type_Input" to determine which screen it should navigate to, based upon the selected value.

 

Obviously, this is a pretty pared down example of what you're doing, but the same basic mechanisms should apply to your situation.

 

Let me know if this helps you out or if you're still running into problems!

 

-Max

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 49 members 4,545 guests
Please welcome our newest community members: