Jump to content
  • 0

Grouping List Report


ServiceBreez

Question

6 answers to this question

Recommended Posts

  • 1

Hello @ServiceBreez

Sorry for the delay,  please check the steps below regarding to the 3rd suggestion:

Important Field(s) to accomplish this: 

ID (Autonumber)

GroupField (Text255)

The idea here is to display the Group field in every first occurance of the group in the report, using a Calculated field and HTML.

Step 1: Create a table containing the mentioned fields

Step 2:  Create a List DataPage and use the table.

Step 3:  Add a HTML Block, that will display the GroupField Like this:
 

<h3 style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px;"><span style="color:#FF0000;">[@field:GroupField]</span></h3>

Step 4: Add a "Calculated Field" that will SELECT the minimum/first record occurance in every Group and use a CASE statement that will hide the  "Grouping Label" is condition not met. Like this:

CASE WHEN ( (SELECT MIN(ID) FROM TableName  WHERE GroupField=target.[@field:GroupField]) = [@field:ID])

THEN ''
ELSE 'none !important'
END

Step 5:  add a Style function and use the calculated field value to  hide the  Grouping label in the other record that doesn't met the condition:

<h3 style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px; display: [@calcfield:1];"><span style="color:#FF0000;">[@field:GroupField]</span></h3>

Notice the "display: [@calcfield:1];" in the code.

Step 6: Hide the Calculated field in the report using this code:
Refer to this link: https://howto.caspio.com/tech-tips-and-articles/common-customizations/how-to-hide-fields-in-datapages/

<table style="display:none;"><tr><td>
  
</td></tr></table>

Make sure that you enclose the calculated field with the HTML Block wit hthe code:
image.png.80730c52bb218cd446e15ae587ec34a7.png

Step 7:  Use the ID as the Default sort order field:
image.png.abfd9c7ad4138f60ac4ad54584d5c889.png

 

You may test it out here:

https://c1abv183.caspio.com/dp/482760000760c781fb574c3e98c2

I have also attached the DataPage and Dependencies for you reference.

 

I hope this helps :) 

CaspioData_2021-Jan-26_1036.zip

Link to comment
Share on other sites

  • 0

Hi @ServiceBreez,

As I know there is no Grouping feature in the "List DataPage"  in a standard way. Here's what I think you can do:

  • Sort the records by the field you want instead, for them to be ordered:
    image.png.aa696aea70b23041f98a660317c2188a.png
  • Create a multiple List DataPage that is filtered base on your Groupfield (not recommended)
  • Or you can do a custom code(JavaScript) that display the HTML Block below in every first occurrence per/base on GroupField. (If you do this, make sure that the record is sorted as well)
    image.png.65597140b2ec18ba88744fb45c0e988d.png

 

I hope the suggestions helps. 

Link to comment
Share on other sites

  • 0

Hi @WatashiwaJin - thank you for that suggestion. 

With regards to the multiple List Datapage, are you suggesting multiple datapages on a webpage?  Or is there something actually called a multiple list datapage?

It sounds like the javascript option sounds promising.  I am not familiar with how to display based on every first occurrence.  Is there a sample you might be able to point me too?

 

(BTW, your creativity is amazing!)

Link to comment
Share on other sites

  • 0

Thank you @ServiceBreez :)

What I suggesting in the second part is "Multiple DataPage on a WebPage" (This is not recommended because it will cause you a lot of DataPage depending on your Group(s)) but if you want to do this, you need to do a seperate search and report DataPage (https://howto.caspio.com/tech-tips-and-articles/tech-parameters/how-to-separate-search-page-and-results-page-into-two-different-webpages/) and alter the system message "No Records found" so when you search for a specific group, that message won't appear in the other DataPage.  Check here on how to change it:
https://forums.caspio.com/topic/6769-no-records-found-message/

 

As for the 3rd suggestion, I was thinking that this is also possible with the use of calculated fields + HTML combination without using JavaScript. Let me try that and get back to you :) 

Link to comment
Share on other sites

  • 0

Hello! I have a similar workflow where I need to do grouping in list datapage and I was able to make the code shorter.

HTML Block 1 

<h3 style="background: rgb(238, 238, 238); border: 1px solid rgb(204, 204, 204); padding: 5px 10px; display: [@calcfield:1];"><span style="color:#FF0000;">[@field:GroupField]</span></h3>

<table style="display:none;"><tr><td>

HTML Block 2

</td></tr></table>

And I enclose the Calculated Field between the HTML Block 1 and 2. 

image.thumb.png.088741c2c9501a317f3c99d1cd7a82c6.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...