Skip to main content

How to set up a condition for a rearrange (hide discount label) - Knowledgebase / Lasernet / Lasernet Developer FAQs - Formpipe Support Portal

How to set up a condition for a rearrange (hide discount label)

Authors list

This article describes 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.

 

3. 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.

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

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

6. 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.


DiscountLabel
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 "";


            
Helpful Unhelpful

Add a comment

Please log in or register to submit a comment.

Need a password reminder?

Share