--- title: "How Do I Set Up a Condition for a Rearrange? - Lasernet Developer" slug: "how-do-i-set-up-a-condition-for-a-rearrange" description: "This article explains how to set up a condition for a rearrange in a header, depending on values in the item lines. Read for more information." updated: 2024-06-19T14:07:47Z published: 2024-06-19T14:07:47Z canonical: "kb.lasernetgroup.com/how-do-i-set-up-a-condition-for-a-rearrange" --- > ## 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? 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. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1619614940618.png) 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. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1619615133439.png) 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. ![](https://cdn.document360.io/c831ef63-c6b3-48ee-b443-3e33644e4e2e/Images/Documentation/1619615264255.png) ### 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. ```plaintext 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 ""; ```