407-248-1481

QuoteWerks Knowledgebase Topic (Article ID 6359)

Layout Designer - How do I use the Contains Operator

This information applies to :

Article ID
6359

Created/Updated
March 4, 2016

Category
Print Layouts


Are you using the most current release of QuoteWerks?
Version 24.0 Build 4
Question:
How do I use the "Contains" operator in the QuoteWerks Layout designer?
(This will appear as a $ sign)

Background:
The '$' character or string character is the xBase Operand for "Contains."

Solution:
You can use the $ operand or InStr() function to determine if a string is contained in another string. For instance, to determine if the word 'Labor' is in the decsription you can use either:

This will evaluate to Y or N (true/false):
"Labor"$documentitems->description

or

This will valuate to the position that the string was found.
If the returned value is greater than 0, then the string was found:
InStr(documentitems->description,"Labor")


Advanced Method
================
The contains ("$") operator can be used in more advanced ways. Let's say an end user wants to print information on the layout in a Report Footer based on whether or not an Item Type is in the quote, or certain information is in the Purchasing Notes.

First you will need a counter to check for the variable in the Document Items:

.if.documentitems->itemtype="Equipment".then.1

...thus every time "Equipment" appears in the Item Type field, it will count. The "counter" should go in a Report Footer somewhere. Double-click the field once it is placed on the layout and make sure it's summarization type is set to "Total".

After that, you can then have a formula that combines the check for the Item Type in conjunction with the Purchasing Notes field. In this case, the forumla is checking to see if the text, "NoWago" is contained within the Purchasing Notes (note, the previous formula field was called "itemtypeadd")):

.if."NoWago"$documentheaders->purchasingnotes.or.calc->itemtypeadd>0.then."Hello world!"

If the two parameters are met, then the field will print, "Hello world!" in the formula box on the layout.

New Search