Passa al contenuto principale

SetCommonVarNumeric

This is simply a procedure (it doesn't return a value). This procedure allows you to hold up to 5 variables in memory as you calculate uncertainty. You would not normally need this procedure when doing most contributing items VBScript since you can declare your variables in VBScript code. However, you might need to look up a gage's FORMULA attribute from within a contributing item's VBScript code. In this case, the FORMULA attribute is another block of VBScript code (you are calling code from within code!). If you ever needed to pass values back and forth between these 2 code bases, you could use the five variables allowed in SetCommonVarNumeric. Here is an example: say you were calculating a contributing item's uncertainty with VBScript code, and within your calculations, you need to calculate the master's coefficient of expansion. This might require a slightly different linear function for each master. So, for each master, you would set up a FORMULA attribute (which gives you a VBScript window to type a formula), and this formula would include the linear calculation. But this linear calculation will likely need three variables as input, which are only known when calculating the uncertainty for your contributing item. So, inside your contributing item's VBScript, you would have code like:

SetCommonVarNumeric(1, 5.5)

SetCommonVarNumeric(2, 3.2)

SetCommonVarNumeric(3, rSomeVariableISetEarlierInCode)

LookupAttributeMaster('MASTER1', 'MYFORMULAATTRIBUTE', nil)

When 'MYFORMULAATTRIBUTE's own VBScript is run (which has the linear function for coeff. of expansion), it can then safely reference ReturnCommonVarNumeric(1), ReturnCommonVarNumeric(2), or ReturnCommonVarNumeric(3), to retrieve the three variables sent by the contributing item code.

So, SetCommonVarNumeric takes two parameters:

  1. | the number of the variable you are setting, from 1-5,2) | the value you are setting for the variable.