Skip navigation
Lucrecious
Currently Being Moderated

Another Null Concatenated field question

Aug 19, 2010 7:15 PM

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...

 
Replies
  • Currently Being Moderated
    Aug 19, 2010 7:17 PM   in reply to Lucrecious

    Try '== null' or 'is null'

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 19, 2010 8:37 PM   in reply to Lucrecious

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points