Examples of Using QLingo
In the example below, we use a plan that has a user view named recipInfo, with the following fields:
-
FNAME (for example, John, Stacy, Suzi)
-
INITIAL (for example, S, G, [empty], Jesse)
-
LNAME (for example, Smith, Brown, Green)
-
ADDR1 (for example, 253 3rd Avenue, 45○ Apple St.)
-
ADDR2 (for example, Bellview, [empty], Riverdale)
-
ZIPCODE (for example, 12345, 12345-8765, 98776-2345-63)
-
CITY (for example, London, New York)
Middle Initials
This example defines an ADOR called FULLNAME, which includes middle initials.
if ([recipInfo][0].[INITIAL] == "")
// Concatenate first name, space, last name
[recipInfo][0].[FNAME] & " " & [recipInfo][0].[LNAME]
Else
// Concatenate first name, space, FIRST CHARACTER OF INITIAL, a period and a space, last name
[recipInfo][0].[FNAME] &" " & SubString([recipInfo][0].[INITIAL], 0, 1) & ". " & [recipInfo][0].[LNAME]
Omitting ADDR2
This example defines an ADOR named ADDR1and ADDR2 (one ADOR for both).
if ([recipInfo][0].ADDR2 == "")
[recipInfo][0].ADDR1
else
[recipInfo][0].ADDR1 & "\n" & [recipInfo][0].ADDR2
Zip code number to barcode
(for a font with an "s" delimiter, such as USPSTTF)
This example defines an ADOR named BarcodedZip that uses a QLingo extension (good for 5, 5-4, 5-4-2 zip codes):
Call USPSZIP.USPSZIP([recipInfo][0].[ZIPCODE], ’s’)
Season calculation
This example calculates the season (Northern Hemisphere) related to the current month.
Define a variable called "MyMonth" (to calculate the month):
AsNumber(Format(|->[MyDate], "mm"))
Then define an ADOR called "Season":
If (MyMonth < 3 OR MyMonth
= 12)
"Winter"
Else If (MyMonth < 6)
"Spring"
Else If (MyMonth < 9)
"Summer"
Else
"Autumn"○○c