Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Variable type

Avatar

Level 3

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 Reply

Avatar

Level 10

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