I am trying to create a collection from a subgallery, I can create a collection from the gallery using
ForAll(
Gallery.AllItems,
Collect(
GalleryCollection,
ThisRecord
)
);
This is great, however, I can see the nested gallery in my new collection however the AllItems are not included, just the gallery control.
I have been trying:
ForAll(
Gallery.AllItems,
ForAll(
Subgallery.AllItems,
Collect(
SubGalleryCollection,
ThisRecord
)
)
);
To no avail, the collection columns are created but nothing is stored in the SubGalleryCollection.
Any idea how I can reference the SubGallery items for each of the gallery items?
Solved! Go to Solution.
Hi @Pen ,
Please implement this as below:
Create a collection with key value pain while you are building the gallery
ClearCollect(collQuestions,{qstnID:1,qst:"",Value:""})
The collection will be as follows:
1,question1,""
2,question2,""
3,question3,""
4,question4,""
On submit / Save click read through this collection and save it back to datasource:
Patch(collQuestions,qstnID=Lookup(collQuestions,qstnID=thisItem.ID,qstnID),{Value:})
Proud to be a Super User!
Regards,Hi @Pen ,
Could you tell me
1)the data structure of the gallery.AllItems?
2)what data do you want from gallery.AllItems? which columns? which control data?
If you could describe with screen shoot , it will be better to understand.
To get data from nested table, we usually use formula like this:
For example: in collection1, to get column field1's data(nested table)
Clear(collection2);
ForAll(collection1,
Collect(collection2,
field1
)
)
Here's a issue about getting data from nested table for your reference:
Best regards,
Hi Phoebe
Thanks for the response.
So this diagram kind of explains (I hope) what I am trying to do:
I can save the individual items in Gallery1 with the following formula, its quite complex due to the nature of the CDS.
Switch(
ThisItem.'Question Type',
'Question Type'.'Large Text',
Patch(
Collection1,
Gallery1.Selected,
{'Master Text Response': responseLargeText.Text},
{Answered: true}
),
'Question Type'.Number,
Patch(
Collection1,
Gallery1.Selected,
{'Master Numerical Response': Value(responseNumber.Text)},
{Answered: true}
),
'Question Type'.Optionset,
Patch(
Collection1,
Gallery1.Selected,
{Answered: true}
);
ClearCollect(
optionsTempCol,
responseOptionSet.Selected
);
ClearCollect(
tempOptionsCol,
Filter(
Collection2,
'Question (Response)'.'Ref Number' = ThisItem.'Ref Number',
Type = 'Type (Question Options)'.'Question Option'
)
);
ForAll(
tempOptionsCol,
UpdateIf(
Collection2,
'Question Option' in tempOptionsCol.'Question Option',
{'Is Selected': false}
)
);
If(
CountRows(optionsTempCol) > 0,
ForAll(
optionsTempCol,
UpdateIf(
Collection2,
'Question Option' in optionsTempCol.'Question Option',
{'Is Selected': true}
)
)
);
,
'Question Type'.'Multi-Select Optionset',
ForAll(
Gallery2.AllItems,
UpdateIf(
Collection2,
'Question Option' = GUID(hidRefNumber2.Text),
{'Is Selected': multiSelectCheck.Value}
)
);
Patch(
Collection1,
Gallery1.Selected,
{Answered: true}
);
);
If(
CountRows(Gallery3.AllItems) > 0,
ForAll(
Gallery3.AllItems,
UpdateIf(
Collection2,
'Question Option' = GUID(hidRefNumber.Text),
{'Is Selected': promptCheck.Value}
)
)
);
Concurrent(
Patch(
Questions,
Collection1
),
Patch(
'Question Options',
Collection2
);
);
This works great, I have to do the patch at the end as the galleries don't update from the collections.
So I am trying to do the above for ALL items in Gallery1.
So when I collect Collection1, the gallery AllItems are blank.
ThisRecord returns the control, but not the items....
Still can't get any of the Gallery2/3 items into the collection but it does work for a Listbox.SelectedItems
/* this Doesnt Work */
ForAll(
Gallery1.AllItems,
Collect(
Collection2,
resMultiSelectGallery.AllItems
)
);
/* this Works */
ForAll(
Gallery1.AllItems,
Collect(
Collection2,
Listbox.SelectedItems
)
);
Hi @Pen ,
Please implement this as below:
Create a collection with key value pain while you are building the gallery
ClearCollect(collQuestions,{qstnID:1,qst:"",Value:""})
The collection will be as follows:
1,question1,""
2,question2,""
3,question3,""
4,question4,""
On submit / Save click read through this collection and save it back to datasource:
Patch(collQuestions,qstnID=Lookup(collQuestions,qstnID=thisItem.ID,qstnID),{Value:})
Proud to be a Super User!
Regards,User | Count |
---|---|
196 | |
124 | |
87 | |
49 | |
42 |
User | Count |
---|---|
284 | |
163 | |
138 | |
75 | |
72 |