I want to know if I can display the count of child records in the parent table view.
Something similar to the count you can display in the child table tab.
Count of child table records in the parent table view
Re: Count of child table records in the parent table view
How shall this look like?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: Count of child table records in the parent table view
If you mean something like this ...
... then ...
... then ...
- Create a new calculated field in your master-table, integer, readonly
- On “Calculated field†tab, check "[X] Automatically calculate the value…"
- Place the following code into the textarea:
Code: Select all
SELECT concat('<span class="badge">', count(*), '</span>' ) FROM `TABLENAME_CHILDTABLE` WHERE `COLUMNNAME_LOOKUPFIELD`= '%ID%'
- In line 2,replace TABLENAME_CHILDTABLE by the name of your child-table
- In line 3 replace COLUMNNAME_LOOKUPFIELD by the column name of the lookup field in your child-table which is referencing your master table
- Generate your application and (re-) load the table view of master table
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Count of child table records in the parent table view
Thank you Jsetzer. works fine.
Re: Count of child table records in the parent table view
Hi Jan,
Correct me if I am wrong, in your suggested steps...
the calculated field should not be integer if you are putting the "<span class="badge">.... right?
It should be VarChar or text field.
Thanks.
Correct me if I am wrong, in your suggested steps...
the calculated field should not be integer if you are putting the "<span class="badge">.... right?
It should be VarChar or text field.
Thanks.
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Re: Count of child table records in the parent table view
Hi, without having checked this, I think you are right, thanks a lot for pointing this out and thank you for all your contributions!
Reason: when answering the request, in first step I was only displaying count and so integer was perfect. In a follow up step I have added that UI badge using concat and did not change the data type. My fault. Anyway: it still works in UI for displaying the badge, which was the requirement. It will not store actual count in DB.
Reason: when answering the request, in first step I was only displaying count and so integer was perfect. In a follow up step I have added that UI badge using concat and did not change the data type. My fault. Anyway: it still works in UI for displaying the badge, which was the requirement. It will not store actual count in DB.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Count of child table records in the parent table view
no worries Master Jan....
Zala.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.
Appgini 24.10.1579, MacOS 14.3.1 Windows 11 on Parallels.