cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Andries
Frequent Visitor

Temp Tables

Hi All 

 

If you create a temp table for example 

 Table({Data:WG_Number},{Data:Email_Line},{Data:'Username & Surename'}); Navigate(User_View,ScreenTransition.Fade)

 

How do you access this temp table later on in a different screen 

1 ACCEPTED SOLUTION

Accepted Solutions

Oh, apologies. What I was intending to say was to use the Set function like so:

 

Set(FirstRecord,
             First(Search('[public].[employee_data]',Search_me.Text,"wg_number")
); 
Navigate(User_View,ScreenTransition.Fade)

The first argument to Set defines the variable name, which in this example is FirstRecord. Hopefully, this code will work for you now.

View solution in original post

10 REPLIES 10
timl
Super User
Super User

Hi @Andries

 

It's not possible to access the result from the Table function from a different screen.

With PowerApps, a collection is the data structure that you would use to store and retrieve data values from multiple screens.

The main function you would use is called ClearCollect.

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-clear-collect-clearc...


Here's the syntax you would use to add records to a local collection called MyTempTable.

ClearCollect(MyTempTable,
             {Data:WG_Number},{Data:Email_Line},{Data:'Username & Surename'}
)


Note that if WG_Number and Email_Line are text input controls, you could access these directly from your User_View screen. This might negate the need for you to use collections all together.

Andries
Frequent Visitor

@timl

 

Thanks for the reply. 

 

If you will permit let me pick your brain then as my own is picked clean 

To give you some info on the problem faced 

 

I have three screens currently in my APP 

 

1] Welcome screen 

 

A] Button  for submission - If(!IsBlank( Search_me.Text ), Navigate( 'User search_1', ScreenTransition.Fade ) )This works fine 

 

B] Search_Me - Text input - This collects a employee number from the user for refrance against a DB - This Works fine 

 

2] User search_1 

 

A] Gallery 5 - Search('[public].[employee_data]',Search_me.Text,"wg_number") - This uses the number inputed by the user and pulls there info onto screen - This works fine 

 

B] There are three Labes that display the user data. WG_number, Email_Line,Username & Surename - This displays but it might be the source of my problem. The DATA is set to "ThisItem.user_name_surename" and show correclty. 

 

Now I want to pass WG_number, Email_Line and Username to the next screen ( User_View).  This is just to make sure they are making a submission on there own names so purely decorative. 

Under User _View 

 

I have the above info as lables but I cant get the data to pull though consistantly. Meaning, it will work once, then If i restart  the app with diffrent numbers ( that live in my DB) the info does not pull though.  Any ideas ?

 

Thanks for the help on this. 

 

 

 

 

 

Hi @Andries

Let's assume that you add a button to the item template of Gallery5 that navigates the user to the User_View screen.

When the user clicks this button, the associated row in Gallery5 will become the selected row. On your User_View screen therefore, you can display your data using syntax that looks like this:

Gallery5.Selected.WG_number

Hopefully, that gives you enough to progress. But let us know if it doesn't work.

Andries
Frequent Visitor

Hi 

 

Thanks for the Reply again 

 

No it does not work or I am placeing it wrong. 

 

Under User search_1 , I have a submit button called Submit (  Navigate(User_View,ScreenTransition.Fade). This goes to 

Userview correctly.  But now under User_View I need to populate User_display, Email Address, Wg_Number_Display 

 

See pictures attached 

example.pngexample2.png

Hi @Andries

 

Thanks for the screenshots. For the technique that I mentioned, your submit button needs to be a child of Gallery5. This picture hopefully illustrates what I mean.

 

 

GalleryChild.JPG

 

Because your sumbit button is outside the gallery, we'll need to do this in a different way.

 

If the wg_number column in your [employee_data] table stores unique values, and Gallary5 will only show 1 record, you can add code to your submit button that stores the first record in a variable, and you can then refer to this in your User_View screen. Here's the formula you would add to your submit button.

 

 

ClearCollect(FirstRecord,
             First(Search('[public].[employee_data]',Search_me.Text,"wg_number")
); 
Navigate(User_View,ScreenTransition.Fade)

 

On your User_View, you can then use the syntax FirstRecord.User_name etc to display the required details.

 

 

Andries
Frequent Visitor

Hi I think i understand.

 

So this is my syntax i used on the submit button

 "ClearCollect(Collection1,First(Search('[public].[employee_data]',Search_me.Text,"wg_number") ));Navigate(User_View,ScreenTransition.Fade) "

Just some clean up on this. 

 

I take it Collection 1 is the variable name ? 

 

Lastly 

 

"In your User_View, you can then use the syntax FirstRecord.User_name etc to display the required details." 

 

My sintax should be Collection1.User_name.wg_number ? 

I seem to be missing somthing to complete that syntax 

 

 

Oh, apologies. What I was intending to say was to use the Set function like so:

 

Set(FirstRecord,
             First(Search('[public].[employee_data]',Search_me.Text,"wg_number")
); 
Navigate(User_View,ScreenTransition.Fade)

The first argument to Set defines the variable name, which in this example is FirstRecord. Hopefully, this code will work for you now.

View solution in original post

Andries
Frequent Visitor

Hi thanks I am being daft. I attached screen shorts again. I have amended the code on the Button under user search _1 as you suggested and it works. But What should the syntax be under User view to retrieve the info. Thanks for your patience and help .
Andries
Frequent Visitor

Hi 

 

i figured it out. 

 

it's Firstrecord1(variable name) . record ( WG_Number) 

 

Works 

 

Thank you again you were fantastic 

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,697)