# Prescription Rules + Taglines

{% hint style="warning" %}
This is an intermediate-level tutorial based on a generic abstract pickzen intended only for demo purposes.
{% endhint %}

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:&#x20;

```
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

Aliases allow referencing user answers easily. In our example we will define the following aliases:

![](/files/-M9xORbJ4pyl1FGa1Bgs)

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.&#x20;

### Tables

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

![](/files/-M9xRXCD36rP_u5GfnlM)

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.&#x20;

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:

![](/files/-M9xS8AqZvDZqyVSMxWx)

This table will be also a datasheet.

#### Executable table

Once we have our data, we need to implement the rules:

![](/files/-M9xNnHcNNJJFJ4UNoXI)

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.

### Simulation

![](/files/-M9xf0701ap2sVYRtaSM)

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.

![](/files/-M9xfYPFiwpfRbX3Nqfe)

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:

![](/files/-M9xgVS_G0E75JwLZVII)

We can easily use any variable declared in the NoCode scope (like first\_tl and second\_tl) in the recommendations slide:

![](/files/-M9xhL9InJxyLBPomaIr)

### Real example

If we execute this Assistant we will get the expected results:

![](/files/-M9xhFho0HlqQ5hB5oav)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.pickzen.com/guides/nocode/tutorials/prescription-+-taglines.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
