Hi Allen, you sure can. We're still working on the documentation for the $group function but you it's currently available for use. The way to use it is is by assigning the output to a new variable like so {{$var "grouped_items" ($group line_items "category")}} This will create a new variable called "grouped_items" that contains the groups of line_items. You should place the function in a section at the top of your template and then repeat another section on "grouped_items". Within that section you can display the name of the group with the {{name}} token and loop over the items in that group by adding a row which you repeat on the "items" variable. Within that row you can add columns and text elements where you display the values of fields in the Line Items table. I hope this makes sense. You can also inspect the structure of the data outputted by the $group funciton by using the $inpect function like so {{$inspect grouped_items 3}} where 3 is the depth of detail that you want to display.
@dimitrisgoudis1603 This should be the same process, you just choose the field you want to sort by and choose ascending or descending, just note that the filed name should be added as the variable style like this my_variable NOT My Variable and you should be good to go
This should be the same process, you just choose the field you want to sort by and choose ascending or descending, just note that the filed name should be added as the variable style like this my_variable NOT My Variable and you should be good to go
IS there anyway to group the table by a common field view. Akin to airtable's in grid grouping functionality?
Hi Allen, you sure can. We're still working on the documentation for the $group function but you it's currently available for use. The way to use it is is by assigning the output to a new variable like so
{{$var "grouped_items" ($group line_items "category")}}
This will create a new variable called "grouped_items" that contains the groups of line_items. You should place the function in a section at the top of your template and then repeat another section on "grouped_items". Within that section you can display the name of the group with the {{name}} token and loop over the items in that group by adding a row which you repeat on the "items" variable. Within that row you can add columns and text elements where you display the values of fields in the Line Items table. I hope this makes sense. You can also inspect the structure of the data outputted by the $group funciton by using the $inpect function like so
{{$inspect grouped_items 3}}
where 3 is the depth of detail that you want to display.
@@Documint Figured it out, thank you for the pointers!!!
Hey @documint, how could sort by a text field or by a date?
@dimitrisgoudis1603 This should be the same process, you just choose the field you want to sort by and choose ascending or descending, just note that the filed name should be added as the variable style like this my_variable NOT My Variable and you should be good to go
Is there a way to sort looped items by a date field?
This should be the same process, you just choose the field you want to sort by and choose ascending or descending, just note that the filed name should be added as the variable style like this my_variable NOT My Variable and you should be good to go