Encoding Variables: Difference between revisions

From Planfix
Jump to: navigation, search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 9: Line 9:


  '''::encode=url'''
  '''::encode=url'''


Suppose you have a task to create a link that, when clicked, passes specific additional parameters from the task, such as the name of a training course. The link then looks like this:
Suppose you have a task to create a link that, when clicked, passes specific additional parameters from the task, such as the name of a training course. The link then looks like this:


  <pre>https://site-course.com/forms/about-course/?course_name={{Task.LEAD's Source}}</pre>
  <pre>https://site-course.com/forms/about-course/?course_name={{Task.LEAD's Source}}</pre>


However, if the course name contains invalid characters, the link data will not be transferred correctly. For example, a link with such a course name:
However, if the course name contains invalid characters, the link data will not be transferred correctly. For example, a link with such a course name:


  Promotion "Learn video editing in just 1 month for free" (2020)
  Promotion "Learn video editing in just 1 month for free" (2020)


Will look like this:
Will look like this:


  <pre>https://site-course.com/forms/about-course/?course_name=Promotion</pre>
  <pre>https://site-course.com/forms/about-course/?course_name=Promotion</pre>


This is because the link contains spaces, and special characters that are not allowed when creating the link. All these characters must be encoded. The '''::encode=url''' function is added to the variables to encode this.
This is because the link contains spaces, and special characters that are not allowed when creating the link. All these characters must be encoded. The '''::encode=url''' function is added to the variables to encode this.

Latest revision as of 10:10, 28 February 2024

Various functions can be applied to variables in Planfix. One of them is:

::encode=url


Suppose you have a task to create a link that, when clicked, passes specific additional parameters from the task, such as the name of a training course. The link then looks like this:

https://site-course.com/forms/about-course/?course_name={{Task.LEAD's Source}}


However, if the course name contains invalid characters, the link data will not be transferred correctly. For example, a link with such a course name:

Promotion "Learn video editing in just 1 month for free" (2020)


Will look like this:

https://site-course.com/forms/about-course/?course_name=Promotion


This is because the link contains spaces, and special characters that are not allowed when creating the link. All these characters must be encoded. The ::encode=url function is added to the variables to encode this.

The correct link with variables should, therefore, look like this:

https://site-course.com/forms/about-course/?course_name={{Task.LEAD's Source::encode=url}}


And the generated link after applying encoding will look like this:

https://site-course.com/forms/about-course/?course_name=%D0%90%D0%BA%D1%86%D0%B8%D1%8F%20%22%D0%9E%D0%B1%D1%83%D1%87%D0%B8%D1%81%D1%8C%20%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D0%BC%D0%BE%D0%BD%D1%82%D0%B0%D0%B6%D1%83%20%D0%B2%D1%81%D0%B5%D0%B3%D0%BE%20%D0%B7%D0%B0%201%20%D0%BC%D0%B5%D1%81%D1%8F%D1%86%20%D0%B1%D0%B5%D1%81%D0%BF%D0%BB%D0%B0%D1%82%D0%BD%D0%BE%22%20%282020%29

So, the course name is transferred to the link without loss.


Go To