Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to print a column in a second row

Avatar

Level 1

Hi,

I have been having this issue for a quite long time now, I want to print a nested table but I want to print it in a line below, like if the nested table were the last column but instead of being printed at right end of the table is printed in a row below.

1611137_pastedImage_0.png

The highlighted in purple is my nested table, is supposed that is info pertaining to the item 1. The line type is different so adding a row is not working for me so far.

Thanks!

9 Replies

Avatar

Level 10

Sorry, but I don't get it. Can you please sketch how the table looks normally and how it should look when the form is printed?

Avatar

Level 1

Sure,

This is the Design View of the item table: as you know, all the orange section is the configuration of a single line:

1611982_pastedImage_0.png

As you can see, there are stacked subforms in the 4th column, they have flowed content that will not be displayed if their fields are empty and also they can increase their height depending on the content of its data. So the height of the row is variable depending on the available data.

Let’s say my item structure is currently like this:

1612004_pastedImage_1.png

The requirement is to add a details table if any of the components of the main product have a special tariff that affected the final price.

The item structure changed to be like:

1612006_pastedImage_2.png

Since there is no more space in the form, the request is to display the details below the actual data. I first added the nested table in a new subform in column 4th.

And I got this as result: the green part is the added table, which is the new field in the item structure.

1612007_pastedImage_3.png

Since still there isn’t enough space, the request is to move the data to the left, But I can’t do that because of the design:

1612008_pastedImage_4.png

If I try to add it, to any of the first 3 columns the table data is immediately printed in the row below and it will not respect the space taken by the subforms in the 4th column.

I tried to add a 2nd row and group them as a section, the second row containing the nested table.  I configured the section to repeat for each data item, and deleted this check box in both tables of the section, but the logic generated by the form is treating the 2nd table as an independent table, is not tied to the first one anymore, e.g if the second main item in my form doesn’t have details, is yet printing the next row in the tariff table, even though it pertains to a different item.

Hope I have explained myself a bit more clear this time.

Avatar

Level 10

Can you please share the form. I don't see a way to help without knowing the actual structure of this form.

Avatar

Level 1

Hi, thanks for your answer.

If you mean the xml file you can download from here:

SFPF_Z_FORM.XML - Google Drive

Or please let me know what exactly you would like to see.

Thank you.

Avatar

Level 10

I was able to extract the nested XDP from you XML and load the form into my Designer. However, I cannot make it run at my end because of the missing data connections  and so.

Anyway, I think you'll only need a script to control the upper distance of you nested table in relation to the 4 stacked subforms in column 4.

Here's my suggestion:
Assuming you want to add a nested table in column 1: Wrap the POSEX field (orange) within a new flowed subform (black bordered) and add the new subform (blue) below. The vertical position of the nested subform (blue) depends on the height of the field (orange). You got that?

1616481_pastedImage_0.png

To control the fields height you need a FormCalc script in the layout ready event like this:

; Object references to subforms

var sf1 = Ref(SF_DESC.SF_IDNKD)

var sf2 = Ref(SF_DESC.SF_ARKTX)

var sf3 = Ref(SF_DESC.Cust_Ref)

var sf4 = Ref(SF_DESC.SF_ZZ_SERIAL)

; Calculate the overall height of all referenced subforms

var sfH = Concat(Sum($layout.h(sf1 , "mm"), $layout.h(sf2 , "mm"), $layout.h(sf3 , "mm"), $layout.h(sf4 , "mm") ), "mm")

; resize this field the the calculated height

$.h = sfH;

Avatar

Level 1

Radzmar,

Thank you so much for your help, I really appreciate that you take time to understand, I know is not easy nor my explanations are clear enough. I'll definitely try this approach since I have not tried this one before and is a very urgent topic now. My doubt is if I'm going to calculate the height of the fields, would the fields on column 4 have an already defined height? My thinking was that at execution time, the dynamic height of the "blue area" would be calculated before to know the final height of the fields on column 4 since the table would be in column 1. But will code this and update, thank you.

Avatar

Level 1

Hi!

I tried the suggested approach, this is what I have achieved so far:

1. Wrap posex field and add new subform: (checked)

1618346_pastedImage_0.png

2. Script:

1618348_pastedImage_1.png

I cannot make it work, not sure if the syntax is correct or where is the error, I have a couple of questions.

  • I wasn't sure about the level where should I place the code, If at the subform "SF_CUSTLI" level (Yellow area) or at the field "POSEX" level (Green area).
  • for the "Ref" function, I'm not sure if I'm addressing the objects correctly, I'm not sure if it should be like the squared in red option or like the squared in green.

This is the result I have so far:

1618352_pastedImage_3.png

The "Tariff Recovery" caption should have flowed till finish the S/N field. The above is an example of how the Serial Number section can grow without limit, all the rest rows inside the subform zz_desc remain the same height, only S/N can expand on demand.

Avatar

Level 10

I think in that scenario you only have to reference to the the subform SF_DESC and take over its height for the POSEX field.

; Object references to subforms 

var sf1 = Ref(SF_DESC)

; resize this field the the calculated height 

$.h = Concat($layout.h(sf1 , "in"), "in")