Idea Details

pdm_if to handle integer addition operation

Last activity 11 days ago
Eduardo Stefani's profile image
07-26-2017 08:25 AM

The customer built a code where pdm_list is used as a looping to increase a counter variable (args.z_counter). The variable starts with value 0 and it is increased according to the pdm_list results (args.z_counter=$args.z_counter+1). Pdm_set is used to set the initial value, as well to increase the variable while pdm_list runs. The final value is used ahead to change the form behavior through pdm_if in order to include or remove certain fields.

 

Example (1): The code below does not work:

 

<PDM_SET args.z_counter=9>
<PDM_SET args.z_counter=$args.z_counter + 1>
<PDM_SET args.z_counter=$args.z_counter + 1>

 

<PDM_IF "$args.z_counter" \<= 10>
<PDM_ELIF "$args.z_counter" \>= 12>
<PDM_ELSE>
</PDM_IF>

 

It does not return the expected result. When args.z_counter is incremented according to the example above, pdm_if is not able to perform the condition properly. In this specific case, it will be always IF, but 9+1+1 is 11 and it should be ELSE.

 

The idea is:

 

Pdm_if to able to handle integer addition operation.

 

Reference:

 

HTMPL Tags - CA Service Management - 14.1 - CA Technologies Documentation 


Comments

03-09-2018 09:28 AM

Thank you for submitting this idea. The product team has reviewed this idea and determined that it does not have enough support from the Community. Therefore, I have marked the idea as not planned. We greatly value your contributions to our community and are committed to continued engagement with you to improve our products.

08-04-2017 10:47 AM

Thank you for submitting this idea. The product team is reviewing this idea and is looking for additional input from other community members.

 

Community Members: If you agree that this is a good idea, please vote and add comments with details about your requirements.

07-26-2017 10:54 AM

Hi,

PDM_IF condition in your code will work fine, to define argument as integer you need to omit quotes (dont forget to define default value to avoid possible errors on null values), example:

<PDM_IF ${args.some_counter:0} \>= 0>
<!-- some_counter >= 0 -->
<PDM_ELIF ${args.some_counter:0} \<= 0>
<!-- some_counter <= 0 -->
<PDM_ELSE>
<!-- some_counter == 0 -->
</PDM_IF>

 

But you can't increment using PDM_SET only concatenate because PDM_SET is designed to work with strings only (check the note from URL you provided: HTMPL Tags - PDM_SET), example:

<PDM_SET args.z_counter=9> 
<PDM_SET args.z_counter=$args.z_counter + 1>
<PDM_SET args.z_counter=$args.z_counter + 1>
console.log("${args.z_counter:0}"); // Result could be "9 + 1 + 1" or something like this

Or

<PDM_SET args.z_counter=9> 
<PDM_SET args.z_counter+=1>
<PDM_SET args.z_counter+=1>
console.log("${args.z_counter:0}"); Result: 911

 

BTW: this is great idea but need to modify PDM_SET not PDM_IF.

 

Best regards,

cdtj