Good evening,
Trying to set a variable on the first gallery item after i search something.
Have a textinput bar and what i would like to achieve is OnChange event to set variable on first gallery item.
Tried to use First(Gallery.Allitems) or something like that but no luck.
If any ideas please share.
Thanks
Solved! Go to Solution.
Hi @Gochix ,
Do you want to select the first item of the gallery?
If so , you could try this on the onselect property of your button control:
Select(Gallery1,1)
Best Regards,
Wearsky
Thanks, this also works. however it doesn't scroll back to top.. So i ended up with this code.
Resets gallery, goes back to top and selects first item in the gallery.
Set(SelectedItemID,First('Main Display'.AllItems).ID);
Reset('Main Display')
I put this code in the OnChange of a Text Input:
Set(var_test2,First(Gallery1.AllItems))
It did put the record in the variable. It is the entire record however. So to display it in a text field, you would need to use just one field (var_test2.Name).
If you only need one field from the record you could use
Set(var_test2,First(Gallery1.AllItems).Name)
to capture just that one field
@BrianS ,
Thanks, your solution works. It set's variable. However I'm trying to display the Display Form once variable is set, but form doesn't change.. Only once i manually select item from gallery as i have onselect event as Set(var_test2, ThisItem.ID)
Set(SelectedItemID,First('Main Display'.AllItems).ID)
Couldn't use Reset(DisplayDetails); This is (Display Form). doesn't look like this works in the same way as gallery would reset..
I've managed to sort this by adding a button that will update everything on select event. It's also quicker to use button rather than allowing gallery to search every time the new text character is typed..
Only question would be is there a way to also set templatefill to go all the way back to top.. As now i have on button select that i will get first item selected if found. but if i scroll down a bit and do a search then templatefill will color the item somewhere in the middle of the gallery...
If(ThisItem.IsSelected,RGBA(255,255,1,0.2),RGBA(0,0,0,0))
Hi @Gochix ,
Do you want to select the first item of the gallery?
If so , you could try this on the onselect property of your button control:
Select(Gallery1,1)
Best Regards,
Wearsky
Thanks, this also works. however it doesn't scroll back to top.. So i ended up with this code.
Resets gallery, goes back to top and selects first item in the gallery.
Set(SelectedItemID,First('Main Display'.AllItems).ID);
Reset('Main Display')
User | Count |
---|---|
255 | |
112 | |
92 | |
48 | |
38 |