4 Replies Latest reply: Aug 19, 2010 9:32 PM by Lucrecious RSS

    Another Null Concatenated field question

    Lucrecious Community Member

      I am having some difficulty returning values checked for null.

       

      The Javascript function is Calculate and my code is as follows:

       

      if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue != null) {
      (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue + " ");
      } else {

       

      }
      +
      if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue != null) {
      (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue + " ");
      } else {

       

      }
      +
      if (xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue != null) {
      (xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue + " - ");
      } else {

       

      }
      +
      if (xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue != null) {
      (xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue);
      } else {

       

      }

       

      The initial value is not null returns properly, however, any subsequent value will override previous values and return the last not null field value.

       

      Please help...

        • 1. Re: Another Null Concatenated field question
          westlakejager Community Member

          Try '== null' or 'is null'

          • 2. Re: Another Null Concatenated field question
            Lucrecious Community Member

            Nope, and I was wrong with the "+" signs as when they are there no values are returned.

             

            Without the "+" signs as follows:

             

            if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue != null) {
            (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue + " ");
            } else {

             

            }

             

            if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue != null) {
            (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue + " ");
            } else {

             

            }

             

            if (xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue != null) {
            (xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue + " - ");
            } else {

             

            }

             

            if (xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue != null) {
            (xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue);
            } else {

             

            }

             

            I don't then get the "Null" value within the concatenated field, however, only the last value which is not null shows in this field.

             

            How do I attach all the fields together?

            • 3. Re: Another Null Concatenated field question
              Srini Dhulipalla Community Member

              Try the following code.. See if it helps.

               

              var strVehicleYear, strVehicleMake, strVehicleModel, strVehicleColour

               

               

              if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue != null)

              strVehicleYear = xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Year").rawValue + " ";

              else

              strVehicleYear = "";

               

              if (xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue != null)

              strVehicleMake = xfa.resolveNode("INPUT.Vehicle.Row[0].Vehicle-Make").rawValue + " ";

              else

              strVehicleMake = "";

               

              if (xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue != null)

              strVehicleModel = xfa.resolveNode("INPUT.Vehicle.Row[1].Vehicle-Model").rawValue + "-";

              else

              strVehicleModel = "";

               

              if (xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue != null)

              strVehicleColour = xfa.resolveNode("INPUT.Vehicle.Row[2].Vehicle-Colour").rawValue;

              else

              strVehicleColour = "";

               

               

               

              this.rawValue = strVehicleYear + strVehicleMake + strVehicleModel + strVehicleColour;

               

              Thanks

              Srini

              • 4. Re: Another Null Concatenated field question
                Lucrecious Community Member

                Helps?

                 

                IT'S PERFECT!!

                 

                Thank you.