cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MityaF19
New Member

Data across multiple screens New or Existing info

I have a Sharepoint list as my data source and and I'm developing an Interview App which currently has 3 screens:

1. Home screen - Fairly standard Gallery that shows a list of past interviews and has an option to add a New record.

2. An Initial Assessment - A screen for the interviewer to record key details and an initial view against 14 set criteria.

3. An Interview Record - The form that is used during the interview to record data

 

To view info from a previous interview the app works wonderfully. I select the record on the Home screen it Selects(Parent) and navigates to the Initial Assessment screen (with the original assessment) and from there I'm able to navigate to the Interview Record. On both screens 2 and 3 the edit forms data source is set to the SP list and the item to GalleryX.Selected (where GalleryX is on screen 1). And this is, I suspect, why I'm having problems when I try and add a new record.

 

When I select to add a new record from Screen 1 it takes me to a blank Initial Assessment (as planned) but when I submit it  (SubmitForm(IAForm); Navigate(screen3, none) ) It takes me to the 3rd screen but shows me data from the last submitted record rather than the data submitted relating to the new record. I do think this is because the Form on Screen 3 has its Item set to GalleryX.Selected but please tell me if you know otherwise. The new Initial Assessment is actually recorded in my List,so I know the SubmitForm is working it just isn't displaying it on screen 3. When I return to Screen 1 it is on the list.

 

So how should I go about ensuring that the data shown and recorded shows New records if that is the route I take or the selected record otherwise.

 

Sorry about the rambling, I'm fairly new to PowerApps and I'm sure that I've fallen down a number of elephant traps on my adventures.

2 REPLIES 2
yshariff Helper I
Helper I

Re: Data across multiple screens New or Existing info

When working with forms and galleries, I find using gallery.selected for the forms items can cause issues with showing wrong records and not working as expected. What I do is on the gallery's on select, I set a global variable for that records ID. Example:

 

Set(varCurrentRecord, ThisItem.ID)

 

Then you set you forms item property to LookUp(YourSharepointList, ID = varCurrentRecord). You should also add to the gallery's on select: EditForm(YourFormsName). That way it sets to edit mode. When you want to create a new record, make sure you use NewForm(YourFormsName).

 

Now when you create a new form and want your screen 3 to show that new form, you should update the form from screen 2 "On Success" to Set(varCurrentRecord, YourFormsName.LastSubmit.ID). This will update the global variable with the new records ID. 

Highlighted
Community Support
Community Support

Re: Data across multiple screens New or Existing info

Hi @MityaF19 ,

This issue is easy to understand, because when you submit the new record, you don't return to galleryx to select the new-created record, so the galleryx.selected won't be the new submission you expect.

The workaround is to pass the item by variable.

  • Set OnSelect of GalleryX : Set(Var_selected, ThisItems.ID)
  • Set Items of Form in screen2: LookUp('SP list', ID= Var_selected)
  • Set OnSuccess of IAForm:  Set(Var_selected, IAForm.LastSubmit.ID)
  • Set Items of Form in screen3: LookUp('SP list', ID= Var_selected)

please have a try and check if your issue is fixed.

Best regards,

Sik

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (9,641)