This page describes some of the features of the Formula Builder and how to save time and even create code you may not have thought possible.

Since we are “amateurs” and do not work with Cyrious all the time, the idiosyncrasies of cfl_ch_3-formulas_and_functions and pricing_ch_19-product_layouts can be daunting. We have found that the CFL formula builder is a great answer to that (See also

cfl_ch_3-formulas_and_functions You can find the code for functions, properties, variables, constants, etc right in the builder, saving the hassle of having to write it down somewhere or leave the builder and navigate around Cyrious to find just what you did name that constant or variable. You will also find hints about how to use that code. Note that if you need more, Cyrious has included a cfl_reference in this Wiki which gives more detail on code syntax.

No cautions. To the contrary we urge anyone trying to build features and functionality in his or her code to click on every item you can find in the folder to see what they do.

  1. The formula builder is accessed in several ways. With Variables there is a small symbol to the right of the formula entry field which will bring it up. In Pricing Modules it is a large button labeled fx Builder. Clicking on these button will bring up a page with 3 sections. If you don't see 3 sections, move your cursor around until you see a double line and then click and drag. This expands the window so you can see it.

**The top section** is the muscle of the Builder and it contains categories or "folders" which contain the actual functions and variable you want and brief hints on how to use them

**The middle section** is where you enter your code. Here Cyrious has included a very helpful visual guide in that the color changes and the type boldens automatically when it recognizes the code. For example, function names like SetTransactionUDF will turn bold and go green as soon as you enter them. Constants will go bold and turn Burgundy. Variables turn dark blue, the whole sections changes to a light blue if you've done something wrong with quotation marks, etc.

**The bottom section** fills with messages when Cyrious thinks you have made an error like forgetting a semi-color or closed parenthesis of part of an "IF Statement". When possible, it tells you what line it thinks your problem is on. It's right most of the time but not always; so sometimes you have to go to other lines to find the issue.. It's not always correct since an omission in a preceding line can sometimes confuse it, but if you stop coding and immediately understand why the message popped up, it will save a lot of grief. It's important to note that Cyrious monitors you while coding; so you will get the red messages of impending death even when you are entering code correctly. For example, when you start an expression with a parenthesis, you will have the error message to close it until you complete the expression.

  1. Finding Variables and Constants while coding is easy with the builder. We find particularly helpful the ability to find a variable by going to the Variables category and selecting the type of variable such as YES/NO. This brings up a list of all the Products which have those variables, If we are looking for a variable in the Delivery Product, such as “ShipsUPS”, we would click on that Product and Cyrious would produce a list in the right hand box of only the YES/NO variables in that product. To further ease the task, we click in the code where we want the variable and then go and double click on it in the top frame. Cyrious inserts it with the correct spelling and then turns it bold and blue.
  2. Finding Code is also an essential help. Often we want to add functionality to the pricing form or a layout but don't know the names of the properties. For example, we wanted to have the Shipping Address appear on the pricing form to alert the user that the default Address might not be correct; We knew we had to find the Property name; so went exploring in the Builder. In the Object Reference Section under the Transheader section, we found a property called “ShipToText” which sounded like what we wanted. We clicked on that, Cyrious inserted Transheader.ShipToText into the code. It turned out to be just what we were looking for. Most of the information we want to show the User in Pricing Forms or Layouts is available and accessible through the builder as in this example and Cyrious is adding additional Properties with each release.
  3. Figuring out How To Use the Code is also facilitated with the builder. Having found the code or expression in the builder, we still need to use it in the formula and often have no idea of the correct syntax. Cyrious provides clues to that in most cases. For example, it is common to want a character count of a phrase to price the number of letters typed in. You will find a String function called CharCount(). In the Builder it shows up as CHARCOUNT(X). When you click on it, you will see an “explanation” at the bottom of the section, “Returns the number of characters in a field.” You may have to think a minute, but it points you to the idea that if you have a string variable named VinylLetters, you can enter that variable directly into the expression CHARCOUNT(x) and it will tell you how many letters are there. To show how this works, here's an example to find the number of letters in a field the user entered. The variable on the Priciing Form which captures the letters is VinylLetters. You would then create a Number Variable we will call NumberOfLetters. Directly under a line labeled Default, you will see a line saying “Use Formula.” Click on the small fx button to the right. This will bring up the Builder. Find the Functions/String Functions category. The top of the list is CHARCOUNT. Click on that and it will insert the following in the code section: CHARCOUNT(. You will also see a string of red messages appear at the bottom of the builder telling you that you have some more things to do to finish. If you forgot what you called the NumberOfLetters variable, go to the Variables section and click on the product and you will see it there. Double click and it will be entered correctly and your code will look like CHARCOUNT(VInylLetters. The error message at the bottom will now tell you that a close parenthesis is needed. Add that and you get a Formula OK message and you have a variable, NumberOfLetters which will return how many letters were entered in that text box..
  4. Lookup Characters. The formula builder provides another (hidden) feature. If hold down the CTRL key and press the space bar (CTRL-Space) in the middle of typing a word, it will show you all the valid combinations that it knows of to complete what you are typing. This is very helpful if you don't remember the exact word (like CharCount from above) or variable name. Just type a few characters and hit CTRL-Space and you'll have a list to choose from. It has a few working quirks (like when you backspace through the entire word) but is a great help.

Contributor: Steve Gillispie, Acorn Sign Graphics

Date: 07/12/2009

Version: Control 3.x, 4.x

You could leave a comment if you were logged in.