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 andLEVEL4. 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 by which you can determine whether it is 1-level, 2-level, 3 level or 4-level dunning level. Lets consider that the field name is DUNNING_LEVEL in which the value contains the Dunning level.
For example,
If the Dunning level is 1 then the value in DUNNING_LEVEL fieldis 1.
If the Dunning level is 2 then the value in DUNNING_LEVEL fieldis 2.
If the Dunning level is 3 then the value in DUNNING_LEVEL fieldis 3.
If the Dunning level is 4 then the value in DUNNING_LEVEL fieldis 4.
From the DATA VIEW, drag that DUNNING LEVEL field inside the layout. Then place it inside the PARENT_DUNNING sub form and then hide this DUNNING LEVEL field.
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 the above code, only the corresponding level dunning text will be shown and the rest will be hidden.
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.