How to set the fabrication instructions for a product type
On the fabrication worksheet, each item (blind, shutter etc) in an order contains the details captured during the survey. You can also include additional instructions based on formulas or fixed values for a product type.
A formula can be an arithmetic expression using numbers and keywords such as width or drop of a blind. You can include text within double quotes in the formula and you can also include variables defined in other formulas.
You must always test your formula in the Fabrication Instructions form using the → button.
Fabrication Formula Examples:
Value Name | Value or Formula | Notes |
Chain length | (fixheight - 1500) + drop * 2 + 50 | fixheight and drop are replaced with values from the Once order |
Vision fabric length | drop * 2 + 500 | if drop is 1000, the result will be 2500mm |
Vision fabric length | drop x 2 + 300 + "mm" | You can also insert text in quotes. You can use x instead of * to multiply values providing you have a space before and after the x. |
Widget A | "Remember to check stock level" | You can include any text within quotes. |
Frame | (width + 20) + " x " + (drop + 20) | If width and drop is 1000 this results in 1020 x 1020 Use brackets to ensure you are adding numbers not text.. |
Conditional expressions
The expression a ? b : c has the value b if a is true else it has the value c.
Value Name | Value or Formula | Notes |
Tube size | drop > 1500 ? "40mm" : "30mm" | evaluates to "40mm" if drop is > 1500 else it is "30mm" |
Cut width | measureType == "Recess" ? width - 25 : width | If the measureType is "Recess" the value is width - 25 else it is the width |
Wand | controls.includes("Wand) ? "Yes" : "No" | controls includes the text "Wand" |
You can nest conditional expressions e.g.
a ? b : (c ? d : e)
If a is false, the result will be d if c is true.
Check if an item has an extra
The expression hasExtra("text") is used to test if an item includes an extra.
Value Name | Value or Formula | Notes |
Cut width | hasExtra("cassette") ? width - 15 : width | Subtract 15mm if the item has an extras group that includes the text "cassette". (The quotes around cassette can be omitted if it is single word with no spaces) |
$CassOpen | hasextra("cassette|open") hasExtra("|open") | True if the item has an extras group containing "cassette" with the text "open" in the selected extras value. You can omit the group name text if the text in the selected extras within the group is sufficient, |
As with product types, you only need a partial match of the extras group name, so "motor" will match both "Motorisation - Charger" and "Motorisation - Hub". The match is not case sensitive.
If you also need to match the extra within an extras group, you can use a "|" (vertical bar), to separate the extras group name text from extra within the group. e.g. hasExtra("cassette | closed").
Variables set by a formula that can be used in other formulas
Variables names start with a $ character. Any $ variables found in a formula will be replaced by the result of the $Variable formula.
Value Name | Value or Formula | Notes |
$WR | measureType == "Recess" ? 25 : 0 | If measure type is "Recess" then $WR is 25 else 0 |
Cut Width | width -$WR | returns the item width minus the value of $WR |
$Cassette | hasExtra("Cassete") | True if there is a cassette in extras else false |
$WRed | $Cassette ? $WR + 10 : $WR | $WRed will be 35 if there is a cassette, else it will be 25 |
$Rec | measureType.includes("Recess") | True if the measureType contains the text "Recess". |
Keywords
The following keywords in a formula will be replaced by the values in the order.
Keyword | Notes |
width drop fixHeight mult extras_price item_price | These keywords will be replaced by their numeric value. mult is the multiple value of an item (set using the Multiple button in Once Mobile) also shown as the Quantity on the Fabrication sheet. |
color controls band fixType measureType notes product range room supplier NofN | These keywords will be replaced by text. e.g. fixType could be replaced by "Blind Size" or "Blind size" The keyword supplier is the "ranges" names in Once Settings and Once Mobile. NofN is the number of the item (blind) and total number in the order. |
turn | These keywords will be replaced by true or false in the formula and can be used in conditional expressions. turn - is true if the fabric must be turned (i.e. the blind width is wider than the fabric width) |
Order values such as custName | See the Substitution Fields in Once Track Label Printing |
Formula Methods
Method | Example | Notes |
---|---|---|
hasExtra() | hasExtra("Cassette") ? 15 : 0 | Results in 15 if the item has an extra with "Cassette" in the extras name, else 0 |
RoundUp() | RoundUp(10.2) | Result is 11. Rounds tup to the next whole number. |
RoundDown() | RoundDown(10.8) | Result is 10. Rounds down to a whole number. |
Javascript Math methods See: JavaScript Math Object (w3schools.com) | Math.round(x) | The JavaScript Math.round() method for rounding to the nearest integer (whole number). All JavaScript Math methods are supported See: JavaScript Math Object (w3schools.com) Note that the RoundUp() and RoundDown() methods are replaced by Match.ceil() and Math.floor() when running the formula. |
The formulas (following the $ variables and keyword substitutions) are executed as JavaScript, hence you can use most standard JavaScript methods. There are many web tutorials and guides e.g. JavaScript Tutorial (w3schools.com) and JavaScript | MDN (mozilla.org) .
JavaScript Methods
You can use most JavaScript methods such as the string method includes() for checking if some text is included in a value.
Value Name | Value or Formula | Notes |
---|---|---|
Frame Width | measureType.includes("Glass") ? width -26 : width | If the measureType includes the text "Glass" then subtract 26 from the width |
Include Zero or Negative Values Checkboxes
If a formula results in a zero or negative value you can choose to omit these from the fabrication instructions.
This can occur if the value is not applicable such as the chain length when the blind is motorised so there is no fixing height specified and the chain length formula results in a negative value.
You can also use this feature to omit a measure where it is not required if you ensure the formula is zero or negative when not applicable e.g. hasExtra("SomeExtra") ? (someExtra_formula) : -1
Formulas resulting in an empty value are always omitted.
Other features
- Formulas can be multi-line.
- Adding comments to a formula: Any text after // (two forward slashes) on a line is ignored. e.g.
// This is a comment
measureType == "Recess" ? width - 25 : width //comment at end of line
Using HTML in the names or Formulas
"<font color='red'>THIS WILL DISPLAY AS RED" | THIS WILL DISPLAY AS RED You can set any html font formats such as color, bold, italic, underline, font size etc. (Note US spelling of color) See: HTML font tag (w3schools.com) |
<hr> | Print a horizontal line (rule) |
<!--> | Prints nothing. Useful if you don't want anything printed in the name or formula as the editor does not allow empty names or formulas. |
"<p style='page-break-after: always;'> </p>" | Insert a page break. Best used as a $ variable that can be used in a Formula. You seem to need to use this HTML in the formula column for it to work. It can be browser dependant and may also need the 'page-break-before' attribute. See: How to add page breaks to html (buildableweb.com) |