Documentation Index

Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt

Use this file to discover all available pages before exploring further.

How Do I Set Up a Condition for a Rearrange?

Prev Next

This article explains how to set up a condition for a rearrange in a header, depending on values in the item lines.

In this example, the input data contains detail lines. One of the columns shows the discount. If none of the item lines includes a discount, the label for the column must be hidden.

  1. Edit the rearrange containing the Discount label and define an object name.

  2. Activate the Script setting.

The script added will return an empty string if none of the item lines contains a discount value or return the contents of the rearrange if at least one of the item lines has a discount value greater than 0.

  1. Edit the rearrange containing the Discount value and set the object name to Discount (or any other logical name). The object name defined on the rearrange must be the same as the object name used in the script.

  2. Set Format Category to Number to represent the column as a number.

  3. Set Number of decimals to 0 to hide the decimals.

  4. Activate Hide if Zero to hide fields containing values equal to 0.

The Discount label is now hidden because none of the item lines contain a discount value greater than 0.

Script

The Rearrange object containing the discount value is named Discount.

Discount.length variable returns the number of rearrange objects in the array named Discount.

Discount[i].text variable returns the value for each rearrange object in the array.

The CurrentRearrange.text variable returns the value of the rearrange object from where the script is being executed.

var setlabel = false;
for (var i = 0; i < Discount.length; i++)
{
 setlabel = (parseInt(Discount[i].text) > 0);
 if (setlabel)
 break;
}
if (setlabel)
 CurrentRearrange.text;
else
 "";

Was this page helpful? Let us know at knowledgebase.feedback@lasernetgroup.com