14.2.6.1. Example 1

Functions can also be used to refer to external files. This is done via vbs files.

[Note]Note

A special license is required here (PSAPI), unless the file is coded as a .vbb file. (CNS2009*PSAPI*LANG*VBS)

A simple use case would be, for example, if the CAD file name for DIN 912 is to be formed differently than for the other DIN standards and again differently for all other projects.

  • The following script call is entered in the PARTlinkManager under "Extras > Configure ERP environment > Standard name or Standard name (short). NB =TSCRIPT(' nb . ruletable ','$CALCED_ROW.','$NB.')

SHORTNB =TSCRIPT('nb.ruletable','$CALCED_ROW.','$SHORTNB.')

  • The file " nb .vbs" must be located under "...setup/scripts/common".

function ruletable (table,calced_row,orgNB)

result=""

mmrow=cint(calced_row)

if mmrow >= 0 then

tmp=table.NN

normname=table.rows.item(mmrow).resolvevariables("$NB.",0)

'1.

if tmp="DIN 912" then

result="ISO4762"+"_"+table.rows.item(mmrow).resolvevariables("$NENN.$MATERIAL.",0)

'The variables NENN and MATERIAL are preceded by ISO4762.

end if

'2.

pos=Instr(1,standard name, "DIN")

if pos >= 1 then

result=tmp+table.rows.item(mmrow).resolvevariables("$NENN.$MATERIAL.",0)

all other DIN standards are formed from NN, NENN and MATERIAL.

end if

if result="" then

result=orgNB

' All other projects are formed with NB.

end if

end if

ruletable=result

end function

Extensive programming could be outsourced in this way.