Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to hide dynamic table row based on cell2 data

Avatar

Level 1

Hi,

I'm trying to hide a row inside a dynamic table if data in cell2 has "Old Statement".

 

If cell2 has the name "Old Statement". Hide that whole row.

 

My code only hides the 1st row.

if (statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry.Cell2.rawValue == "Old Statement")
{
statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry.presence = "hidden";
}
else
{
statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry.presence = "visible";
}

 

Manqoba_0-1585853144696.png

 

I'm new to Livecycle designer and would really appreciate the help. 

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 10

If you put the following code into the calculate event of rwStatementEntry, it should work.

 

 

this.presence = Cell2.rawValue === "Old Statement" ? "hidden" : "visible";

 

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

If you put the following code into the calculate event of rwStatementEntry, it should work.

 

 

this.presence = Cell2.rawValue === "Old Statement" ? "hidden" : "visible";

 

Avatar

Level 1
Hi @radzmar. The code is giving me syntax errors. "Error: syntax error near token '=' on line 2, column 34."

Avatar

Level 10
Make sure you've selected JavaScript not FormCalc as language.

Avatar

Level 1

Hi @radzmar, after doing the hidding. I'm now struggling with sorting the same table by date descending.

var Cell1Array = new Array();
var Cell2Array = new Array();
var Cell3Array = new Array();
var Cell4Array = new Array();
var Cell5Array = new Array();
var Cell6Array = new Array();

 

var rowIM = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry").instanceManager;

 

for (var i=0; i < rowIM.count; i++) 

{

var Cell1 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell1").rawValue; Cell1Array.push(Cell1);

var Cell2 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell2").rawValue; Cell2Array.push(Cell2);

var Cell3 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell3").rawValue; Cell3Array.push(Cell3);

var Cell4 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell4").rawValue; Cell4Array.push(Cell4);

var Cell5 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell5").rawValue; Cell5Array.push(Cell5);

var Cell6 = xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell6").rawValue; Cell6Array.push(Cell6);

}

Cell1Array.sort();

Cell2Array.sort();

Cell3Array.sort();

Cell4Array.sort();

Cell5Array.sort();

Cell6Array.sort();

 

for (var i=0; i < rowIM.count; i++)

{

xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell1").rawValue = Cell1Array[i]; xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell2").rawValue = Cell2Array[i]; xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell3").rawValue = Cell3Array[i]; xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell4").rawValue = Cell4Array[i]; xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell5").rawValue = Cell5Array[i]; xfa.resolveNode("statementForm.sfStatementForm.sfStatementSummary.sfStatementEntries.tblstatementEntry.rwStatementEntry[" + i + "].Cell6").rawValue = Cell6Array[i];

}