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).