How to Write Your Own Custom Logic for Function Calling

How to Write Your Own Custom Logic for Function Calling

Perfect Doc Studio not only provides predefined functions but also allows users to create their own custom logic using function call text manipulations. This enables you to tailor document behavior according to your unique business rules.

Steps to Add Custom Logic
1. Navigate to the area in your document where you want to apply the logic and type @.
2. A list of predefined functions will appear, along with an option called Custom Logic. Click on it.


3. A modal window will open where you can enter your custom logic.


4. Once you have written your logic, click Save.


5. The saved logic will automatically be applied when the document is generated.



Below are the Function Call Text Manipulations supported in Perfect Doc Studio:
  1. if-else – Returns one value if a condition is true, and another if it is false.

  2. substring – Extracts part of a string starting from a given position.

  3. string-length(var) – Returns the number of characters in a string.

  4. concat – Joins two or more strings together.

  5. contains – Checks if a string includes a specific sequence of characters.

  6. starts-with – Checks if a string begins with a specific sequence of characters.

  7. ends-with – Checks if a string ends with a specific sequence of characters.

  8. empty – Tests whether a value or variable is empty.

  9. round – Rounds a number to the nearest whole number.

  10. floor – Rounds a number down to the nearest whole number.

  11. ceiling – Rounds a number up to the nearest whole number.

  12. substring-after – Returns the part of a string that comes after a given substring.

  13. substring-before – Returns the part of a string that comes before a given substring.

  14. translate – Replaces specific characters in a string with other characters.

  15. matches – Checks if a string matches a given pattern (regular expression).



    • Related Articles

    • What is Function Calling?

      Function calling in Perfect Doc Studio is the process of executing predefined text manipulation functions within a template. It allows users to apply custom logic, such as formatting, validation, or conditional rules, on data variables or static ...
    • How to Call a Function in a Document or Email Template

      Function calling in Perfect Doc Studio allows you to dynamically insert values or apply logic within your document templates. Steps to Call a Function 1. Navigate to the location in your document where you want to apply a function and type "@". 2. A ...
    • Auto Generating Content in a Document

      In PerfectDoc Studio, you can quickly produce content by specifying the topic title of interest. The system is equipped to efficiently generate content across a broad spectrum of topics almost instantaneously. To make use of this functionality, ...
    • What is Business logic?

      Business Logic refers to the set of rules and conditions that determine how information is displayed, structured, or processed within a document. Instead of generating static, one-size-fits-all communications, business logic allows documents to adapt ...
    • What is a Business Logic?

      Business Logic refers to the set of rules and conditions that determine how information is displayed, structured, or processed within a email. Instead of generating static, one-size-fits-all communications, business logic allows documents to adapt ...