HomeGuidesRecipesAPI
HomeGuidesAPILog In

Auto Logic

Overview

The auto logic question is an invisible question type used for inserting or excluding content and formatting text in generated documents on a set of rules configured by the project's designer. These rules can refer to selections made in the question set, formulas, or values retrieved from data sources. As the auto logic question type is invisible it is only appropriate for controlling content document only, not the hiding and showing of items within the question set in Produce.

Rules are like conditions, stating that the content in question is relevant or irrelevant based on the stated rules. For example, a rule might be to include an extra paragraph in the document if the client is over the age of 55 years. In this example, the rule would be ‘age is greater than 55’, and would be associated with the content to go in if the condition is met.

If the rules resolve to true the answer becomes active and content will be removed, included or formatted as configured. For example, display all outstanding accounts in red and include an overdue notice. Multiple rules can be applied to a single piece of content catering for complex scenarios.

650

Auto Logic Usage Example - Monthly Invoice

Document PreparationSelection or insertion placeholders can be used to mark content in the document that is to be removed if not needed or inserted from the content library where needed.
UsageRules are applied to the answers to an auto logic question and are expressed by selecting what type of condition the rule is imposing, and where the information is coming from to determine if the rule is met.

Multiple rules can be grouped into ‘any of’ and ‘all of’ groups where they combine to determine if the content will be included in the generated document.
Rule TypesRules can be one of three types, which determine the behavior in how the rule resolves. The rule types are as follows:
AggregateAn aggregate formula that references a set of data, either from a repeating section or page or from a multi-row data source. For example, check if any ‘age’ field in the referenced data set is greater than 55.

You can define your rule to be met if any record in the referenced data matches the condition, or if all records must match.

For more information see Aggregate functions.
Answer ValueAnswer value rules refer to another question's answer and compares it to a given value. For example, an ‘age’ text field answer is greater than 55. This is the most common rule type.
FormulaA formula is used to compare to a given value. For example, calculate age based on a date of birth, and check if it is greater than 55.
Fragment OutputFragment Outputs are used to reference a fragment's output to check if a comparison is true or not.

How to add an Auto Logic Question

  1. From the toolbox, drag and drop an Auto Logic question onto a page, section column or tab.
1913
  1. SmartIQ automatically adds an answer to the new question. Click on the answer to view its properties.

  2. Give the Answer an appropriate name.

698
  1. Use the Action drop-down to select the action that the Answer will perform when the configured rules are met. Insertion/Removal will determine if the content is appropriate whereas Apply Style will format a selection of content.

  2. If Apply Style has been selected choose an appropriate word style, note that only custom Word styles are available for selection, not base styles such as ‘Heading 1’.

  3. Click on the Rules tab of the answer.

  4. Select the rule type from the Type drop-down list. Refer to Rule Types above for more information on each type.

1915
  1. If you select the ‘Answer Value’ rule type, complete the following properties:

Question

Select a question from the drop-down list to reference for the rule’s comparison. The list of answers updates to show each answer in the selected question.

1919

Answer

Select the answer from the drop-down list to reference for the rule’s comparison.

1919

Repeating question

This property is only available if you are referencing a multi-row data source, or a question within a repeating page or repeating section.

This allows you to control whether the rule is met when any record referenced matches the comparison, or whether all records must match.

A quick method of creating Answer Value rules is to drag and drop the answer to be referenced onto the rules pane. When you drag and drop an answer, a default comparison type is selected and may require modification.

1915
  1. If you select the ‘Aggregate’ or ‘Formula’ rule types, enter a valid formula or aggregate formula in the Formula property.

  2. Select a comparison type from the Comparison property, and enter a value in the provided textbox or drop-down list. This value will be compared with the answer, formula result or aggregate formula result.

  3. Click Add to store your rule. You may use the Update and Remove buttons to modify your rules when needed.

453
  1. Drag and drop any appropriate placeholders or content library items onto the answer.
299

If the Answer is a logic type any placeholders or content items belonging to the answer will be included and removed based on the result. Whereas for the style rule type the content within any placeholders will be set to the specified word style if the rules resolve to true.

A list of all the auto logic rules that a question is referenced by can be retrieved by right-clicking a question in the question set and selecting the Find Dependencies option from the pop-up menu.

"All of" and "Any of" Rule Groups

For more complex situations, multiple rules may need to be grouped together. For example, the client needs to be male, over 55 and have 2 or more dependents in order for the content to be relevant. ‘All of’ and ‘Any of’ groups cater for this situation by processing multiple rules together.

698

In other words, an ‘all of’ group of rules is only satisfied if all of the rules in that group are met. If any one of them are not met, the answer is deemed irrelevant. Inversely, an ‘any of’ group needs only one of its rules to be met for the group of rules to be satisfied, making that answer relevant.

How to Create "All of" and "Any of" Rule Groups

  1. In the Rules tab, click All Of Icon to create an ‘All of’ group or Any Of Icon to create an ‘Any of’ group.

  2. With the group selected add rules as described above.

  3. Add additional groups as needed by the situation, groups can be nested inside one another as per the example below.

341

Auto Logic within Repeating Sections and Pages

When you place an auto logic question within a repeating page or repeating section, the rules are processed for each ‘record’ added by the end user in Produce. For example, consider the following repeating section

762

The above repeating section is capturing information about a number of books, including title, author, price, and discount. Let’s say there is a paragraph that must be included only if a discount applies, otherwise, it’s to be excluded from the document – but this must happen for each book individually, as some will have discounts while others will not. The question set will include an auto logic question with the rule stating if the Discount answer must be greater than ‘0’ to include the ‘Special Price’ message.

In the following question set, the auto logic question is placed outside the repeating section that captures the data. In this case, the rule will not be applied to each book added in the repeating section, and the resulting document will appear as depicted below. Notice that the ‘Special Price’ message is displayed even for items with no discount

732

In order to apply the rules of the auto logic to each book added in the repeating section, the auto logic question must be nested within the section itself. Typically it should go into the column it’s most relevant to, in this case, the ‘Discount (%)’ column, however, it will work in any column. When this is updated, the resulting document will appear as below:

629

This applies the same to repeating pages as it does to repeating sections, so the auto logic question should be nested within the repeating page for it to act on each record of data.

Auto Logic with Multi-Row Data Sources

698

When using an Auto Logic question to include content based on value(s) sourced from a multiple-row data source an important distinction needs to be made:

The auto logic question is to include a single piece of content based on the values across the entire record set. For example, if an extra page of information is to be included at the end of the document if at least one DangerousGoods field is equal to ‘TRUE’.
The auto logic question is to include content based on each record. For example, include the words ‘paid’ or ‘funds outstanding’ in the document for each customer based on an Amount Owing field within the customer record.

Depending on which of the above is chosen, the Auto Logic question must/must not have a Parent Question property set.

When the parent question property is not set, the logic is processed across the entire record set.
When the parent question property is set, the logic is processed for each record.

Auto Logic across multiple records

After configuring a multiple row data source question add an Auto Logic question to the project. Give it an appropriate name and navigate to the Rules tab of the question's Answer.

📘

Note

  1. Do not assign a parent question to the Auto Logic.
  2. The ‘Repeating Question:’ drop down is available allowing you to choose if every answer or a single answer (field within the data source) needs to match. Configure your rule(s) as per the screenshot below.
652

Auto Logic is for each record

Once again, configure a multiple-row data source question and add an Auto Logic question to the project. This time navigate to the question's ‘Parent’ tab and set the Parent Question Property.
Set appropriate rules for the Auto Logic Answer as per the screenshot below.

698

Auto logic rule question and comparison referencing

The Auto Logic question type makes use of the reference feature to provide direct comparisons to other questions or formulas instead of providing a constant value. This avoids the use of formulas to compare two questions.

455

The created “Statement of Advice” page retrieves ‘Weekly Salary’ and ‘Weekly Rent Paid’ as inputs from users and provides advice based on the inputs using Auto Logic. The advice is inserted based on comparing 50% of the weekly salary (a dynamic formula) to the rent paid (a text field question).

760

In the figure below, we are inserting the “Advice_greater_than_or_equal_50_percent” bookmark only if the "Weekly Rent Paid" text field question is "Greater than or equal to" the formula "50% Of Salary" ([3.9]).

This reference can be obtained by first clicking the reference icon at the right end of the ‘Comparison:’ and then clicking ‘50% of Salary’ answer.

Referencing Auto Logic Answer

You can use references to Auto Logic answers, just like any other question type.

The Auto Logic will return a "1" or a "0" depending on whether or not its Rules are True or False.

333

Using an Auto Logic with a Multiple-row Data Source (Parent Question)

698

When using an Auto Logic question to include content based on value(s) sourced from a multiple-row data source an important distinction needs to be made:

  • The auto logic question is to include a single piece of content based on the values across the entire record set. For example, if an extra page of information is to be included at the end of the document if at least one DangerousGoods field is equal to ‘TRUE’.
  • The auto logic question is to include content based on each record. For example, include the words ‘paid’ or ‘funds outstanding’ in the document for each customer based on an Amount Owing field within the customer record.

Depending on which of the above is chosen, the Auto Logic question must/must not have a Parent Question property set.

•When the parent question property is not set, the logic is processed across the entire record set.
•When the parent question property is set, the logic is processed for each record.

Auto Logic across multiple records

After configuring a multiple-row data source question, add an Auto Logic question to the project. Give it an appropriate name and navigate to the Rules tab of the question's Answer.

📘

Note

  1. Do not assign a parent question to the Auto Logic.

  2. The ‘Repeating Question:’ drop down is available allowing you to choose if every answer or a single answer (field within the data source) needs to match. Configure your rule(s) as per the screenshot below.

652

Auto Logic is for each record

Once again, configure a multiple-row data source question and add an Auto Logic question to the project. This time navigate to the question's ‘Parent’ tab and set the Parent Question Property.

Set appropriate rules for the Auto Logic Answer as per the screenshot below.

698