Uploaded image for project: 'Xporter for Jira'
  1. Xporter for Jira
  2. XPORTER-4065

Javascript isn't working when using nested conditions with loops

    XporterXMLWordPrintable

Details

    • Bug
    • Status: Open
    • Medium
    • Resolution: Unresolved
    • None
    • Continuous Delivery
    • Exporting
    • None
    • UNCOVERED

    Description

      Description
      Javascript isn't working when using nested conditions with loops
      Javascripts with if or for work as expected, but when nesting an if inside a for or a for inside an if it isn't processed anymore.

      How to reproduce
      Use the following code as a template

      Loop1 (if only works): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);if(arServ.length > 1){strListServ+=' ' +0+'. '+arServ[0];}strListServ.toString();}}
      
      Loop2 (for only works): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);for (i in arServ){strListServ+=' ' +i+'. '+arServ[i];}strListServ.toString();}}
      
      Loop3 (for with nested if no worky): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);for (i in arServ){if(i<arServ.length){strListServ+=' ' +i+'. '+arServ[i];}}strListServ.toString();}}
      
      
      Loop2 (for inside if no worky): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);if(arServ.length >1){for (i in arServ){strListServ+=' ' +i+'. '+arServ[i];}}strListServ.toString();}}
      

      Actual result/Attachments

      Expected result
      Every version should be processed

      Attachments

        Activity

          People

            rmbr Rui Rodrigues
            joao.silva João Silva
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: