Hi @WaMCHCH ,
Could you please share a bit more about the 101, 102, ... columns in your CDS Entity? Are they 'Two Options' column or 'Option Set' column in your CDS Entity?
Do you want to load record from your CDS Entity into Question Gallery based on the specific UserID?
Further, could you please show more details about the formula you typed within the Items property of the Gallery?
I assume that you want to load record from your CDS Entity into Question Gallery based on the specific UserID, is it true? I have made a test on my side, please take a try with the following workaround:
1. If the 101, 102, ... columns are all 'Two Options' column in your CDS Entity:
Within you Questions Gallery, set the Default property of the Toggle control to following:
If(
QuestionNumberBox.Text = "101", /* <-- QuestionNumberBox represents the Label in your Gallery to display the Question number value */
If(LookUp('YourCDSEntity', UserID ="Specific User ID").101 = '101 (YourEntityName)'.yes, true, false),
QuestionNumberBox.Text = "102",
If(LookUp('YourCDSEntity', UserID ="Specific User ID").102 = '102 (YourEntityName)'.yes, true, false),
QuestionNumberBox.Text = "103",
If(LookUp('YourCDSEntity', UserID ="Specific User ID").103 = '103 (YourEntityName)'.yes, true, false),
...
...
)
2. If the 101, 102, ... columns are all 'Option Set' column in your CDS Entity:
Within you Questions Gallery, set the Default property of the Toggle control to following:
If(
QuestionNumberBox.Text = "101",
If(LookUp('YourCDSEntity', UserID ="Specific User ID").101 = [@101].yes, true, false),
QuestionNumberBox.Text = "102",
If(LookUp('YourCDSEntity', UserID ="Specific User ID").102 = [@102].yes, true, false),
QuestionNumberBox.Text = "103",
If(LookUp('YourCDSEntity', UserID ="Specific User ID").103 = [@103].yes, true, false),
...
...
)
In addition, if you want to update the 101, 102, 103, ... column when you switch the Toggle control in your Gallery, please set the OnSelect property to following:
If(
Toggle1.Value = true,
If(
QuestionNumberBox.Text = "101",
Patch(
'YourCDSEntity',
LookUp('YourCDSEntity', UserID ="Specific User ID"),
{
101: '101 (YourEntityName)'.yes
}
),
QuestionNumberBox.Text = "102",
Patch(
'YourCDSEntity',
LookUp('YourCDSEntity', UserID ="Specific User ID"),
{
102: '102 (YourEntityName)'.yes
}
),
...
...
),
If(
QuestionNumberBox.Text = "101",
Patch(
'YourCDSEntity',
LookUp('YourCDSEntity', UserID ="Specific User ID"),
{
101: '101 (YourEntityName)'.no
}
),
QuestionNumberBox.Text = "102",
Patch(
'YourCDSEntity',
LookUp('YourCDSEntity', UserID ="Specific User ID"),
{
102: '102 (YourEntityName)'.no
}
),
...
...
)
)
More details about updating a Option Set type column in CDS, please check and see if the following blog would help in your scenario:
https://powerapps.microsoft.com/en-us/blog/option-sets-and-many-to-many-relationships-for-canvas-apps/
More details about the Patch function, please check the following article:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch
Best regards,