1 Reply Latest reply on Nov 29, 2010 12:24 PM by Steve L Walker

    Variable type

    HyungSikKIM

      Dear All

       

      I tried to set a path of field as below Code.

      in case of case1, i can set a presence property to extPath.

      but in case of case2, i can't set a presence property to extPath.

       

      is there any function to change type of variable such as toString().

       

       

      case 1

           var extPath = Test_Report.Test_Result2;

      case 2

           var extPath = "Test_Report.Test_Result2";

       

       

       

       

       

      ------------------------------------------ Code ------------------------------------------

      var extPath = Test_Report.Test_Result2;
      var typeOfdevice = Test_Report.Test_Cover.sub_Cover_info.Cover_info.info_Device.D_Drop.rawValue;
      var changeEvent = xfa.event.change;

           if(typeOfdevice == "범용"){
                Init.setPresence(extPath, "visible");

           }

       

       

       

       

      // In the Init variable group

      //Set Presence of Field or subform
      function setPresence(obj, block){
      obj.presence = block;
      };

        • 1. Re: Variable type
          Steve L Walker Level 5

          var extPath = Test_Report.Test_Result2.rawValue;

           

          If est_Report.Test_Result2 is a text field extPath should be a string. If you are suspicious of type coercion and run-time errors you can use standard JavaScript methods, for example

           

          var str = Test_Report.Test_Result2.rawValue;

          var extPath = str.toString();

           

          or

           

          var str = Test_Report.Test_Result2.rawValue;

          var extPath = parseInt(str);

           

          or

           

          var str = Test_Report.Test_Result2.rawValue;

          var extPath = parseFloat(str);

           

          etcetera.

           

          Steve