I have a table in Dataverse that contains, among other things, a text column of screen names to be used for navigation inside Power Apps.
In the OnStart property of my app, I can directly code the same information, and it works for navigation. For simplicity, let's say that I already have screens called "News" and "Sports", and then directly create a table like this:
Set(vMyTable,
Table(
{Value: "News", Icon: Icon.Newspaper, Screen: News},
{Value: "Sports", Icon: Icon.Globe, Screen: Sports})
When I do that, because the screens, "News" and "Sports" are already created, the resulting table's "Screen" column (if you click on the table variable "vMyTable" to view the contents) is stored within that table as [Control], not as a string. That actually works for navigation because the Navigate function is looking for a [Control] object (In this case, a Screen object).
However, if I try to assemble the same table by doing lookups from Dataverse:
Set(vQuestionNumbers, LookUp(QuestionSets, QuestionSetName = vName, SetMembers)); //Get the question set members
Set(vQuestionSet, Concat(vQuestionNumbers, Value & ",")); //Create a comma-separated string from the set members
Set(vMyTable,With({_items: Split(vQuestionSet,",")}, //Next few lines create a table of info about each question, such as what screen it appears on.
ForAll(
Sequence(CountRows(_items)),
{Screen: (LookUp(Questions, Screen = Last(FirstN(_items).Value).Value, Screen)), //The value of the "Screen" column in the Questions table. Note that (_items).Value refers to a specific row, and the extra ".Value" afterward refers to the column called "Value" in that row. Then the ending "Screen" on that line refers to what column I'm returning the value from.
Icon: (LookUp(Questions, Screen = Last(FirstN(_items).Value).Value, Icon)), //The value of the "Icon" column in the Questions table
Value: Value //The numeric value of the sequence, effectively making a label so that the selected questions show up as 1,2,3..., rather than the "News" and "Sports" examples above.
}
)
)
)
The resulting table is similar to the example above of a directly-created table, BUT the difference is that the "Screen" column doesn't hold an [Control] value, it holds a string. That string can't be used with the Navigate function because it's expecting an object.
So... any ideas how to get around this? I have to do a lot of manipulation to Get members of a question set from one table, match those up with the questions in another table, and get the names of the screens to navigate to in the app. I just can't seem to get my programmatically-created table to store the screens as the screen objects, rather than the text of the screen names.