Hi all experts.
I have earlier used InfoPath a lot, and wtached a video with Shane Young about using a collection and a gallery in the same way. The video os very good and it works like a charm, I'm only having a problem with two drop down controls in the galery.
When I press the save icon to save data to the collection and create a new row, it sort of resets all the rows to a default, and not only the new row. I have tried everything, but cannot figure out how to avoid this behavior. The data is saved in the collection, so that part is okay, but from a user perspective it looks crazy when all the lines in the tables is beeing reset. This is only happening with the drop down controls, the text input fields are working okay.
The save icon has this code attached:
Patch(Rekvisition; ThisItem; {AVarelinie: DropdownVarelinje.Selected.Value; BMængde: TextInputMaengde.Text; CEnhed: DropdownEnhed.Selected.Value});; Collect(Rekvisition; {AVarelinie: ""; BMængde: ""; CEnhed: ""})
The two drop down fields has no default value, because the fields are a lookup in a SharePoint list. I have done this many times, and it works great, but just not when I'm creating a new collection
Hope anyone has a solution to help me reach my goal.
/Frank Nielsen
Denmark
Solved! Go to Solution.
Hi @venseben ,
Is this a gallery control in this screenshot? What is the Item property of this gallery? Did you mean that the default property of dropdown controls are blank? What value do you want to set for the default value after submitting?
Regards,
Mona
Yes, it is a gallery that i have attached in the screenshot. Everytime i pressed the save icon on the right, it did a reset of the value in the dropdown control for all the lines in the gallery, very very strange. However, late last night I came up with an solution. I created a non visible label called "LabelDefault", that has an default text value. I enden up with setting the two drop down fields to set the default data from that label everytime i made a new collection. So now the drop down fields is acting like I want it, maybe not in an elegant coded way, but it works.
Collect(Rekvisition; {AVarelinie: LabelDefault.Text; BMængde: ""; CEnhed: LabelDefault.Text})
This behaviour has been driving me crazy for weeks, and suddenly this "non-hack" solution came to me.
Hi venseben,
I encountered the same issue on my app as well. I changed the Default property of the drop down control to ThisItem.Value
Hope this helps.
Regards!
Hi @venseben ,
Is this a gallery control in this screenshot? What is the Item property of this gallery? Did you mean that the default property of dropdown controls are blank? What value do you want to set for the default value after submitting?
Regards,
Mona
Yes, it is a gallery that i have attached in the screenshot. Everytime i pressed the save icon on the right, it did a reset of the value in the dropdown control for all the lines in the gallery, very very strange. However, late last night I came up with an solution. I created a non visible label called "LabelDefault", that has an default text value. I enden up with setting the two drop down fields to set the default data from that label everytime i made a new collection. So now the drop down fields is acting like I want it, maybe not in an elegant coded way, but it works.
Collect(Rekvisition; {AVarelinie: LabelDefault.Text; BMængde: ""; CEnhed: LabelDefault.Text})
This behaviour has been driving me crazy for weeks, and suddenly this "non-hack" solution came to me.
Hi venseben,
I encountered the same issue on my app as well. I changed the Default property of the drop down control to ThisItem.Value
Hope this helps.
Regards!
would you be able to share an sample of a gallery as repeating table with multiple dropdowns in it. I cannot get it to work and its been driving me nuts for months...
Hi @venseben,
I am new to this and working on a repeating table using a gallery as well. Mine will have dropdowns that are from SharePoint lists.
Does your initial collection look like this:
Or like this
Thanks
Hi again @JR-BejeweledOne I forgot that I had some serious trouble finding a way to stop the gallery from inheriting data from previous rows. I could not figure out why it did that, but ende up with a bit of a dirty trick. As you can see in this picture my each dropdown fields has a standard value "Vælg..." (Choose in english).
To ensure that the two dropdowns had this when I pressed the save icon, I created two labels, and made this when I made the patch function.
It is two hidden labels, but when I make a new row/collection, these fields are the deault value in a new row. The balue in the labels are "Vælg..."
Hope this can help you. I knos it could have been fixed in a much smarter way, but I am not a code guy and deffenitly not a Excel shark, so i had to come up with some kind of solution. And the users are happy, and so I am happy 🙂
/Frank
Your post was extremely helpful to me. Along with yoru post and the reply about using ThisItem.xxx in the default value, I was able to get my app working very nicely.
Mine is a bit unique. I have fields that I needed to concatenate to create a name that would be populated in the gallery but didn't want the 4 fields that make up the name to be in the gallery. You can see mine below.
To stop inheriting data from other rows, you need to use 'ThisItem' in your patch statement and set your default values to ThisItem.xxx.
User | Count |
---|---|
224 | |
100 | |
94 | |
57 | |
31 |
User | Count |
---|---|
281 | |
114 | |
110 | |
63 | |
57 |