calculate each element of an array

Jay Schille jayschille at gmail.com
Tue Feb 12 11:35:09 PST 2008


You could do this using arraychange(.

This works:

local oRay1, oRay2
oRay1="3"+¶+"4"+¶+"7"+¶+"8"+¶+"9"
oRay2=arraychange(oRay1, str(val(array(oRay1, 1,¶))*2), 1, ¶)
oRay2=arraychange(oRay2, str(val(array(oRay1, 2,¶))*3), 2, ¶)
oRay2=arraychange(oRay2, str(val(array(oRay1, 3,¶))+3), 3, ¶)
oRay2=arraychange(oRay2, str(val(array(oRay1, 4,¶))/4), 4, ¶)
oRay2=arraychange(oRay2, str(val(array(oRay1, 5,¶))-2), 5, ¶)

Embedding the arraychanges would be more compact:
	oRay2=
		arraychange(
			arraychange(
etc.

>  >I'd like to calculate, ie do the arithmetic, on each element of a 
>>carriage return separated array.
>>
>>The array looks like this:
>>
>>3*2
>>4*3
>>7+3
>>8/4
>>9-2
>>
>>I'd like to get a second array that looks like:
>>
>>6
>>12
>>10
>>2
>>7
>>
>>I know I should be able to find this in the docs but I can't seem to.
>
>I don't think the function you are looking for
>exists, but you could create it. It would be a
>procedure you would call with a call( function.
>
>Local FunctionResult
>FormulaCalc FunctionResult, parameter(1)
>FunctionValue FunctionResult
>
>You would then use the call( function in an ArrayFilter.
>
>Dave
>_______________________________________________
>Qna mailing list
>Qna at provue.com
>http://provue.com/mailman/listinfo/qna


-- 
Jay Schille


More information about the Qna mailing list