06-08-2010 09:31 AM
Hello All,
I'm trying to convert an existing Excel spreadsheet into DIAdem. I use several functions defined in office like the MATCH and INDEX functions. I could not find similar functions in DIAdem. It would be time-consuming to write an equivalent VBScript for these functions.
Do we have similar functions in DIAdem ?
syntax :MATCH(lookup_value,lookup_array,match_type)
Returns the relative position of an item in an array that matches a specified value in a specified order. Use MATCH instead of one of the LOOKUP functions when you need the position of an item in a range instead of the item itself.
INDEX(array,row_num,column_num)
Returns the value of an element in a table or an array, selected by the row and column number indexes.
Thanks
Vamshi
06-08-2010 04:58 PM - edited 06-08-2010 05:01 PM
Vamshi,
For the MATCH function you may want to take a look at the PNo or the ChnFind function:
ReturnValue = PNo(ChannelName,Value)Input Parameters
ChannelName | Specifies a channel name. |
alue | Specifies the value or text to search for. |
ReturnValue | Returns the number of the first row with contents that are closest to the specified value or text. |
ReturnValue = ChnFind(FormulaTxt, [ChnFindStartIdx])
FormulTxt | Specifies a formula in a script. Enter the formula in quotation marks. You must enclose texts that are in quotation marks, such as channel names, in double quotation marks. |
[ChnFindStartIdx] | Specifies the line number at which DIAdem begins checking the data channel for a condition. By default DIAdem checks the data channel in the command ChnFind from the first row and in the command ChnFindReverse from the last row. |
ReturnValue | The return value is an Integer type. Returns the first line number that satisfies the given condition. If no row of the data channel meets the condition, the ChnFind command returns the result 0. If the ChnFindStartIdx variable is longer than the channel, the ChnFind command returns the result 0 |
For the INDEX function you can use the ChDX(row, Ch_index) variable. You specify the row (or index) in the channel you want to retreive the value from, and then the Ch_index or the number of the channel you want to get the value from. Ex:
Dim MyValue
MyValue = CHDX(3,2)