jscript function return object or JSON object

 0 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
TimC
Veteran Member
Posts: 84
Veteran Member

    Use Case:

        Have central flow that returns a structure of 2 dates: paymentDate and payThroughDate;

         I tried two techniques that I debugged in VisualStudio and they work there. So, pasted them in to an Assign script var.

     

    Abridged Version

    subFlow:

    function calcDates(frequency)

    {

         logicToCalcDates;

         var pDates

         pDates = {"paymentDate":paymentDate,"payThroughDate":payThroughDate}  //JSON object

         /*

            or,

            pDates = function(){}  //jscript object

            pDates.paymentDate = paymentDate

            pDates.payThroughDate = payThroughDate

         */

         return pDates    

    }

     

    the calling script (same flow)

    Assign node

    pDates = eval(calcDates("TUESDAY"))

    paymentDate = pDates.paymentDate

    payThroughDate = pDates.payThroughDate

    At this point, both the above vars are "undefined"...... Hmmm...