Prescription Rules + Taglines

This is an intermediate-level tutorial based on a generic abstract pickzen intended only for demo purposes.
Say you have 8 products, with SKUs PZ-1 to PZ-8, and need to recommend a set of two of them from certain rules. You have also three questions with the following answers:
Question 1: big, small
Question 2: light, heavy
Question 3: classic, fashion
The requirements are the following:
1 - Prescribe the first product based on the first question (Rule 1):
small: PZ-1
big: PZ-2
2 - Prescribe as second product: the product that meets question 2 and question 3 (Rule 2):
light: PZ-7, PZ-5, PZ-6
heavy: PZ-6, PZ-3
classic: PZ-4, PZ-5
fashion: PZ-7, PZ-8
3 - If no second product was found, prescribe the matching product from question 2 (Rule 3):
light: PZ-7, PZ-5, PZ-6
heavy: PZ-6, PZ-3
Also, we need to show one customized tagline for each of the recommended products.
In this example, we will define the Aliases and the needed tables. Finally, we will do some simulations to ensure everything is working correctly.


Aliases allow referencing user answers easily. In our example we will define the following aliases:
We see that each answer is mapped to an alias name that will be used later. We are also creating here three labels that will later simplify the readability of the rules: Q1, Q2-3, and Q2.


We will need three tables, one table with the Logic, another one with the prescription rules, and finally a table with the tagline texts.

Prescription table

In this table, we can see the products that are associated with each answer. We can also see a weight column that will be used to order the recommended products, so PZ-1 and PZ-2 will be always recommended as the first product because their weight is higher.
In order to create a recommendation based on the requirements, we need a Logic table that will use this data to select the products to recommend.

Taglines table

The tagline table will be map each product with a tagline:
This table will be also a datasheet.

Executable table

Once we have our data, we need to implement the rules:
Here we can see in rows 1 to 3, the three rules implemented through the PRESCRIBE formula. As we see, we will use a temporal variable named skus to store the SKUs to recommend.
Note we are using here the labels we defined before: For example, both formulas are equivalent in our context:
PRESCRIBE(data, Q1, 'matchany', skus)
PRESCRIBE(data, '1:2',':', 'matchany', skus)
Using labels we can improve the readability when there are multiple formulas.
As we need to recommend only two products, in row 4 we get the first 2 products using the TRUNC formula and send them to the RECSKUS formula that will ultimately create the recommendation.
Finally, rows 5 and 6 will generate both taglines using in this case the TABLEVALUE formula.


In this case, PZ-1 will be selected because it is associated with the small answer, and PZ-5 will be selected because it is the product that appears in Q2 and Q3 according to Rule 2.
In this case, PZ-2 will be selected because it is associated with the big answer. According to the rules, there are no products that appear simultaneously as a result in Q2 and Q3, so Rule 2 is not met. Therefore, from Rule 3 we get PZ-7 associated with the light answer.
We can see the taglines in the browser console along with other internal data:
We can easily use any variable declared in the NoCode scope (like first_tl and second_tl) in the recommendations slide:

Real example

If we execute this Assistant we will get the expected results:
Last modified 1yr ago