cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Advocate I
Advocate I

Form not able to reference Gallery field unless hard coded.

I have a table of Transactions that show up in my vertical gallery. Each transaction has a bookie name. I also have several bookie tables with details of the transaction. I am trying to get my form to show the details relating to the bookie name. The top image shown will work if I hard code the "Ladbrokes" bookie name but when I try and reference it in the middle image, it recognises the bookie name but does not work. I even tried setting a variable as 'varBookie' on the last image which shows "Ladbrokes" but again doesn't work. I have spent days trying to figure this out but I am still very new to this. Please help.

PhilSta_0-1604228260451.png

In case the text is too small to see, here are the texts in the formula bars.

LookUp( Ladbrokes, TransID = Gallery1.Selected.TransID, Stake )
LookUp( Gallery1.Selected.BackBookie, TransID = Gallery1.Selected.TransID, Stake )
LookUp( varBookie, TransID = Gallery1.Selected.TransID, Stake )

 

1 ACCEPTED SOLUTION

Accepted Solutions

I have managed to find a workaround by using the Switch command which has worked. I would prefer a better solution but here is my solution with just a few of the bookies if it helps anyone.

Switch(Gallery1.Selected.BackBookie,"Ladbrokes",LookUp(Ladbrokes,TransID = Gallery1.Selected.TransID, Stake),
"Novibet",LookUp(Novibet,TransID = Gallery1.Selected.TransID, Stake),
"Bet365T",LookUp(Bet365T,TransID = Gallery1.Selected.TransID, Stake),
"Betfred",LookUp(Betfred,TransID = Gallery1.Selected.TransID, Stake),
"Coral",LookUp(Coral,TransID = Gallery1.Selected.TransID, Stake),
"Race Bets",LookUp(RaceBets,TransID = Gallery1.Selected.TransID, Stake),
"A888Sport",LookUp(A888Sport,TransID = Gallery1.Selected.TransID, Stake)
)

View solution in original post

10 REPLIES 10
Super User III
Super User III

It not clear whether you are looking up in the same table or another table?

But try:

LookUp(YourTableName, TransID = Gallery1.Selected.TransID, Stake )

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thank you for your reply. I had tried that in my first image where I hard coded the table "Ladbrokes" but when I change the selection in the gallery view (which uses the "Transactions" table) it does not reference the new selection bookie. Table examples:

 

Table1 -Transactions       Table2  Ladbrokes           Table3 Coral                 Table4 Bet365

TransID  Bookie          Stake     Odds  TransID     Stake   Odds TransID  Stake  Odds Tran...

1            Ladbrokes      10          3             1              5          2         2         2        3        3

2           Coral               15          2             12           12         5         10       15      4        17

3           Bet365              5          1.5          13            6          3          14       10      2        18

I hope this helps.

Did you get error by trying:

LookUp(Ladbrokes, TransID = Gallery1.Selected.TransID, Stake )

 

From your table, only one row of Transaction matches with LadBrokes

 

if you still have issues, show a screenshot of the form with the default of the textbox to pupolate

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Sorry the last tables did not come out right. Here it is again as an attachment

 
 
 

 

Yes LookUp(Ladbrokes, TransID = Gallery1.Selected.TransID, Stake ) works.

But as that is hard coded to the Ladbrokes table, when I change it to a different selection in the gallery to Coral, it will not work.

How do you make the change?  "when I change it to a different selection in the gallery to Coral, it will not work"

Are you using different Gallery at same time?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

I am using a gallery for the Transactions table and the form should show the details from from the different tables when selected from the gallery. Here is a screenshot of what I am working on. Thanks for your help on a Sunday.

You have confirmed that this formula works.

Yes LookUp(Ladbrokes, TransID = Gallery1.Selected.TransID, Stake ) works

 

Note you have about three tables with different columns. You cannot put all the three on the same Gallery. 

 

So if you want all the three on the same Gallery, then I suggest you combine the tables into one.

Then the Combined table Will be put on the items of the Gallery.

 

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Thanks again for your reply.

Yes, if I put "Ladbrokes" in hard code it will work but I wanted it like a variable so that I could change the table according to the selection in the Gallery. This is because there are around 20 tables but I have only shown 3 as an example.

From my screenshot it shows that when I use "Gallery1.Selected.BackBookie" it gives me the text of "Ladbrokes" and if I change my selection in the Gallery it will show "Bet365" for example but the Lookup function does not seem to like it unless it is hard coded.

I am unable to put all 20 tables into one file as they include calculations that are specific to each table.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (36,503)