I'm still working on my canvas app and its coming along great. Thank you all for your help.
Data base is SQL
Data has Parent/Child relationships between groups. For instance a Law firm is a Parent Group and then the Lawyers in the firm being the child of the law firm.
The 1 screen is a typical list screen of both Parent and Child.
OnSelect of either Parent or Child, user is navigated to the second screen you see below with demographic info.
At the top I have a label that i would like to display the Parent Group Name if the item selected from Gallery1 is a child. Assuming a child was selected, I would then like for the Parent Group Name to be selectable so that it displays the Parent group demographics in the form you see below. I'm struggling with how to write the formula. Any help appreciated.
This is what I've tried so far:
If(Gallery1.Selected.ParentGroupID > "0", Navigate(ListScreen,ScreenTransition.None), Refresh(GroupContactInfoForm.ParentGroupID)
I'm sure I'm not quite close but can't get my head around how to write this correctly.
Any help appeciated.
I believe you are making it more complicated than it needs to be. If your Law Firm table contains a Primary key, I am assuming that your Lawyers table contains a Foreign Key that relates back to the Law Firm table, perhaps LawfirmID. Assuming, on your first screen, you have a gallery with the datasource of Law Firms (lets call it Gallery1) and either a TextInput or Dropdown control for selecting the firm. The gallery then populates with the names of the Lawyers in the firm. In each item in the gallery there is likely the name of the lawyer and an icon that if pressed, will Navigate() to the second screen.
On your second screen, put a Display form and set its Datasource to Lawyers and its Item property to
The form should populate its fields with the information from the selected Lawyer from the gallery. If you put an edit form on a third screen, you would set the datasource and Item properties to the same settings as above and then you can edit the information about the selected lawyer in the gallery.
Hi @SeanTambling ，
Firstly, Gallery1.Selected will not be empty value.
It is the first record of the gallery by default.
It can not be set to blank.
It means that , no matter whether you select item in the gallery, Gallery1.Selected will not represent an empty item.
So using "Gallery1.Selected.ParentGroupID > "0"" can not justify whether you select item in parent group.
Secondly, Refresh function is used to refresh data source.
The right syntax is : Refresh(data source)
Could you describe more clearly about if you do not select item in parent group, you want to do what?
I'm not sure what does GroupContactInfoForm.ParentGroupID represnt.
I suggest you use a variable to justify whether you select item in the parent group.
For example, set the arrow button (inside the gallery) 's OnSelect:
If(!IsBlank(var), Navigate(ListScreen,ScreenTransition.None), //if you select item in the gallery, the variable will be updated
Reset(GroupContactInfoForm.ParentGroupID) //I assume that GroupContactInfoForm.ParentGroupID is a control
Hi @v-yutliu-msft ,
Thanks for trying to understand what i was saying. I think i didn't word my request very well.
Thank you for your correction on the syntax for Refresh. That is a big help.
I'm getting closer but I haven't quite got it right.
The SQL database does have Parent/Child relationships
Parent = Group
Child = Individual
Some groups do not have any individuals linked to them, other groups do.
On the first screen, there is 1 Gallery1 that displays everyone in the database, both groups and individuals. In that list i have not as yet distinguished between groups or individuals. I just let the app user filter for the name they are looking for.
On navigating to the second screen (whether the app user chose group or individual) there is a form that displays the "item" demographic info. I also have a second gallery at the bottom of the screen that shows any individuals that are linked to the group.
If the app user selectes a Parent I want the header box to be blank. If they choose a Child I want the header box to display the name of the Parent. I'm using this for now (Gallery1.Selected.ParentGroup) , but I still need to write the rest that will leave the field blank if a Parent was chosen.
If a child was chosen, then I'd like for the header box to be selectable, so that the app user could navigate to the same screen, basically refreshing the screen, displaying the Parent demographic info. This is what i've rewritten. It's close but still not correct.
OnSelect = LookUp('[dbo].[vwGroups]', Gallery1.Selected.ParentGroupID = ID, ID) ; Refresh('[dbo].[vwGroups]')
The child does have a foreign key called ParentGroupID that = the ID of the Parent. I just don't know how to have the Parent demographic info display in the form on the GroupContactScreen.
Maybe I'm overthinking it or maybe it's way more complicated or possibly impossible. I've tried a bunch of different formulas and i'm not getting anywhere with this specific issue.
The app works great in general. Lots of cool wiz bang stuff but this issue is ...... ugh
We're excited to announce our first cross-community 'Can You Solve These?' challenge!
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
We are excited for the next Super User season.
FIll out a quick form to claim your community user group member badge today!
Features releasing from October 2020 through March 2021