Hello,
GetDataVal cannot get the fields inside record types (built-in or user-defined).
You can always access the fields explicitely, i.e. jActJoint.robax.rax_1, but this may not be what you want to code.
If you really have to do this programmatically, then one possible idea is to build your own field access procedures and then use late binding to execute them:
PROC ReadJointValues()
VAR num nJointValues{6};
VAR num i;
VAR jointtarget CJointTarget;
VAR string tempString;
CJointTarget := CJointT();
FOR i FROM 1 TO 6 DO
tempString := “getJtargetRobAx_Rax_” + NumToStr(i, 0);
%tempString% CJointTarget, nJointValues{i};
ENDFOR
ENDPROC
PROC getJtargetRobax_Rax_1(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_1;
ENDPROC
PROC getJtargetRobax_Rax_2(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_2;
ENDPROC
PROC getJtargetRobax_Rax_3(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_3;
ENDPROC
PROC getJtargetRobax_Rax_4(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_4;
ENDPROC
PROC getJtargetRobax_Rax_5(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_5;
ENDPROC
PROC getJtargetRobax_Rax_6(jointtarget tempTarget, VAR num jointValue)
jointValue := tempTarget.robax.rax_6;
ENDPROC
This may not the be cleanest way, better to simply do a known extraction:
nJointValue{1}:=jActJoint.robax.rax_1;
nJointValue{2}:=jActJoint.robax.rax_2;
nJointValue{3}:=jActJoint.robax.rax_3;
and so on,
Steve