Help with a couple of template issues

Posted by: davej on 20 September 2024, 3:27 pm EST

  • Posted 20 September 2024, 3:27 pm EST - Updated 20 September 2024, 3:55 pm EST

    I’m working on a proof-of-concept template and have two issues I haven’t been able to work out.

    Data is currently multiple records of:

      startDate
      endDate (optional - can be null)
      name
      address
      city
      state
      zip
      notes
      highlight
      id
      parentId

    1. Generally, the records should be listed one per row but the notes should be placed below the name on a separate row. Each record should take up 3 rows where the 3rd row is a spacer formatted to be shorter than a normal row.
    	A		B	C	D		E		F		G
    1 	startDate	endDate	name	address		city		state	zip
    2				notes
    3

    This is very doable but now the complexity comes in. For any given ‘id’, there could be additional records that must be expanded in the same record (between rows 1 and 2). These records are identified by a ‘parentId’ with the value of the parent ‘id’. The notes can be take from any of these records as they are all the same.

    	A		B	C	D		E		F		G
    1	startDate	endDate	name	address		city		state	zip
    					address...
    					address...
    2				notes
    3

    Note that the “inner” records (if any) cannot relate based on startDate/endDate. Currently it’s just the hidden fields that define the grouping.

    Since this is an all new implementation the data can be changed to make the template work but I’ve yet to work out a solution.

    Can you anyone help me out with how this can be configured - data and template?

    1. The second issue is related to the above as well. Based on the condition, highlight = true, all rows of a record except the spacer row need to be shaded. For most records that will be just the first row and notes row. However, if there are multiple inner rows, they must be shaded as well. A common style will be applied to provide the shading.

    This may need to be done in post-processing code and I’m good with that but I wanted to throw it out in case anyone else has had to do this with a template. Any pointers are appreciated.

    I’m using DsExcel 7.2.1.

    Thanks!

    Dave

  • Posted 23 September 2024, 7:46 am EST

    Hi Dave,

    Apologies for the delay in response.

    We have attached a sample template file and java file showing the implementation we created as per our understanding of your description. Please see if it fits your requirements.

    If you have any further questions, please let us know and we will be happy to help you!

    Attachment: SampleProj.zip

    Best Regards,

    Kartik

  • Posted 26 September 2024, 5:24 pm EST

    Thank you so much for your guidance. Handling the highlighting looks really good and the other data formatting is close. I’ve uploaded a revised version with some slightly modified data.

    1. Is it guaranteed that data added to the spreadsheet is in the order provided? I need for the name to only show once per group so I dropped it for all but the first one in each child.
    2. I dropped the notes for all but the first in the group as well and it only shows the note once which is perfect. However, there is an extra line added that I would like to remove - line 6. You will notice I added a spacer row to the group which should always be added.
    3. My ideal solution will not have parent Id showing and I already removed child Id. If data is grouped by the start and end dates, will that work to replace the parentId?

    Generally, I would love to see more comprehensive examples of the context, range and group properties with complex data. Maybe a high level description of how data is selected and placed into the spreadsheet would help understand how to put the various flags together for something challenging.

    Thanks again!SampleProj.zip

  • Posted 27 September 2024, 7:40 am EST

    Hi,

    Is it guaranteed that data added to the spreadsheet is in the order provided?

    Yes, the Data processed in the template is as per the order in the DataSource.

    If data is grouped by the start and end dates, will that work to replace the parentId?

    Yes, it would work, but the dates must match between the required rows to be able to group them correctly.


    Also, we did further research and implementation regarding your requirement, and unfortunately, it does not seem to work by using Templates alone. It seems to require some post-processing after the template completes its work. We have attached two new sample projects that demonstrate both the template usage and the post-processing steps required to achieve the desired result.

    template2.zip

    template1.zip

    Please check these and let us know if they work as per your requirement.

    Thanks, and Best Regards,

    Kartik

  • Posted 1 October 2024, 10:07 am EST

    Thank you Kartik. I really appreciate the time and effort you put into the sample code!

    I think I can make those options work for the customer.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels