cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slhangen
Helper V
Helper V

Pass item info from one screen to another

Hey Community! I need help navigating to a new screen with a filtered gallery.

 

SP Lookup List is:  STUDENT DEMOGRAPHIC INFORMATION

SP Patch List is: AT HOME LEARNING STUDENT CONTACT LOG

 

I am on the ContactHistoryScreen.  I want to go to the StudentHistoryScreen but only have info from the selected item display.

 

When I click on an icon in my gallery (galStudentContacts_2) in ContactHistoryScreen, I want to open the StudentHistoryScreen with the selected item filtered out. So basically, filter a gallery across screens.

 

My StudentHistoryScreen pulls data from the following variables:

varStudentID, varStudentName, varStudentFirstName, varStudentLastName

Currently, I have a text box that pulls up a gallery (would rather do this with a combobox but I haven't figured that out yet). 

When I click an item On Select does:

UpdateContext({varStudHistOtherID: ThisItem.OtherID});
UpdateContext({varStudHistLastName: ThisItem.StudentLastName});
UpdateContext({varStudHistFirstName: ThisItem.StudentFirstName});
UpdateContext({varStudHistAdvisor: ThisItem.Advisor});
UpdateContext({varStudHistGrade: ThisItem.Grade});
UpdateContext({varStudHistAge: ThisItem.Age});
UpdateContext({varStudHistGuardian: ThisItem.GuardianFullName});
UpdateContext({varStudHistAddress: ThisItem.Address});
UpdateContext({varStudHistPhone: ThisItem.Phone});
UpdateContext({varStudHist2ndPhone: ThisItem.'2ndPhone'});
UpdateContext({varStudHistEmail: ThisItem.'E-Mail'});

 

My gallery populates based upon:

SortByColumns(Filter('AT HOME LEARNING STUDENT CONTACT LOG', LogOtherID = varStudHistOtherID),
"LogContactDate", Descending, "LogContactPerson", Ascending)

 

I need to pass the variable info when the user clicks the icon in the galStudentContacts_2 gallery in the ContactHistoryScreen to the StudentHistoryScreen but I have a cursory understanding of global and contextual variables.

 

thanks for your time.

24 REPLIES 24
Eelman
Super User
Super User

@slhangen 

Firstly, you could reduce the number of variables you are using down to one, if you like, and then use Dot notation to reference the data, eg

 

UpdateContext({varStudHist: This Item}) // one variable

 

Referencing:

 - OtherID = varStudDist.OtherID, etc

 

Also UpdateContext() is a variable that is only 'alive' on the screen it gets created on ie local/context variable. You use Set() to create variables that can be used across all screens, eg

 

Set( varStudDist, ThisItem) // same referencing as above

 

Hope this helps.

 

Thx for your prompt reply.  How do you call the variables of you set them all at once.

Set( varStudDist, ThisItem)

How do I call say varStudentName or any other fields within the varStudDist array?

 

Thx again

 

@slhangen 

The same way you would if using UpdateContext, ie

 

OtherID = varStudDist.OtherID

 

StudentName = varStudDist.StudentName, etc

 

If you would like to visualise the variable data you can put it into a collection for view eg

 

Set( varStudDist, ThisItem );

ClearCollect( colStudDist, varStudDist)

 

Then in the Editor you can go View --> Collections --> colStudDist to see the data.

Ok, on select of icon:

Set(varStudentHistory, ThisItem );
ClearCollect(colStudentHistory, varStudentHistory)

 

When I reference colStudentHistory.LogStudentName I get an expected text value error.

 

Please advise:{

Ok, I got something by referencing the variable instead of the collection.  But I need to pull some information from my main Lookup SP list.

 

Lookup SP List: STUDENT DEMOGRAPHIC INFORMATION

Patch List: AT HOME LEARNING STUDENT CONTACT LOG

 

I tried to set the STUDENT DEMOGRAPHIC INFORMATION to global var on app start:

Set(varStudentBasicInformation, 'STUDENT DEMOGRAPHIC INFORMATION');

But when I reference varStudentBasicInformation.StudentName I get an expected text error. (See below)

 

screenCapture.JPG

 

 

@slhangen 

 

Sorry, got called away.

 

This code:

Set(varStudentBasicInformation, 'STUDENT DEMOGRAPHIC INFORMATION');

Creates a table of data inside your app with many records - hence the table error.

 

Where we used this code

Set(varStudHist, ThisItem);

It created a table with ONE record which is why you can use Dot ( . ) notation ie varStudDist.StudentName

 

To use the varStudentBasicInformation variable you will need to use LookUp using some reference field, eg

 

LookUp(varStudentBasicInformation, ID = ThisItem.ID, StudentName);

 

 

 

Thank you.  Always been confused about what the ID is for.

Getting Name isn't valid error.

 
 

Capture.JPG

 

@slhangen 

I used 'ThisItem.ID' because I thought you maybe using a gallery to select an item. Try adding a random ID number instead of ThisItem.ID, eg 10. The error should go away. If so, this means the formula isn't get a ThisItem reference so you will need to sort that out.

Can you explain what I need to get the lookup to match? I see how the varStudentHistory returns a record and varStudentBasicInformation returns a table.

 

I tried LookUp(Text(varStudentBasicInformation.StudentName) = varStudentHistory.LogStudentName) to get the record out but no bueno.

Capture1.JPGCapture2.JPG

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,302)