cancel
Showing results for 
Search instead for 
Did you mean: 

Printing texts in subforms dynamically based on condition

Former Member
0 Kudos

Hi All,

I have to print dunning level texts( 1,2,3,4 ) based on the dunning level. This text should be printed above the main Items table gets printed.

Currently I have created a subform for the main table and it is priting correctly. But i wanted to print the dunning level text  above the main table as said.

I know that some form calci scripting logic needs to be written to print the text dynamically.

( I have some idea that 4 subforms to be created for 4 dunning levels texts and condition to be written in form calci ( visible / hidden ). But at a time only one dunninglevel text subform needs tobe printed and then immediately main table should get printed.

Can anyone please helpme out how to print the text dynamically in the subform ?

Thanks and Regards,

Karthik Ganti.

Message was edited by: Dezso Pap - Moderator

Accepted Solutions (0)

Answers (3)

Answers (3)

pavan_prabhu
Active Participant
0 Kudos

Hello Karthik,

     You can achieve this requirement. What you need to do is create 4 separate flowed sub forms of 1-level, 2-level, 3 level and 4-level texts. Let the name of these sub forms be LEVEL1, LEVEL2, LEVEL3 and LEVEL4. Now wrap all these 4 sub forms in a parent sub form. Let the name of the parent sub form be PARENT_DUNNING. Hide the LEVEL1, LEVEL2, LEVEL3 and LEVEL4 sub forms from the layout. Don't hide the PARENT_DUNNING sub form.

Now there should be some field in some importing or global structure with which you can determine whether it is a 1-level, 2-level, 3 level or a 4-level dunning level. Lets consider that the field name is DUNNING_LEVEL whose value contains the Dunning level.

For example,

If the Dunning level is 1 then the value in DUNNING_LEVEL field is 1.

If the Dunning level is 2 then the value in DUNNING_LEVEL field is 2.

If the Dunning level is 3 then the value in DUNNING_LEVEL field is 3.

If the Dunning level is 4 then the value in DUNNING_LEVEL field is 4.

From the DATA VIEW, drag that DUNNING LEVEL field inside the layout(design view). Then place it inside the PARENT_DUNNING sub form in the hierarchy tab and then hide this DUNNING LEVEL field from the layout.

Now in the script editor, write the JavaScript code on the PARENT_DUNNING sub form in the Initialize event as below.

if ( this.DUNNING_LEVEL.rawvalue == "1" )

{

     this.LEVEL1.presence = "visible";

}

elseif ( this.DUNNING_LEVEL.rawvalue == "2" )

{

     this.LEVEL2.presence = "visible";

}

elseif ( this.DUNNING_LEVEL.rawvalue == "3" )

{

     this.LEVEL3.presence = "visible";

}

elseif ( this.DUNNING_LEVEL.rawvalue == "4" )

{

     this.LEVEL4.presence = "visible";

}

By writing this above code, any one of the 4 dunning texts will be visible based on the dunning level.

Now you have already wrapped the table is a sub form. Now wrap that table sub form and your  PARENT_DUNNING sub form in a flowed sub form. Let the name of the sub form be MAIN_SUBFORM. Then in hierarchy tab, place the PARENT_DUNNING sub form above table sub form so that dunning level texts will be shown first followed by the table data.



Former Member
0 Kudos


Hi Krishna,

I did the same thing currently. But I wanted to achieve the samething through layout only, not writing any code in the driver program.

I wanted to handle the pritning of dunning texts dynamcially based on the dunning level in the layout only.

How to achieve this?

Thanks and Regards,

Karthik Ganti.

Former Member
0 Kudos

Hi Karthik,

If I am not wrong you want to print the Dunning Text and Main table one after other. And you want to print the Dunning text based on the dunning label for that document.

I would suggest you to determine which text need to be printed in the driver program itself. So instead of deciding in the form you can filter the text by putting condition . You can confirm in the driver program and pass the text to the form. And this will print the text straightly.

If I am not able to understand your query properly please give some more details on this.

Thanks,

Krishna.