Page 1 of 1

Execute Command

Posted: Mon Nov 19, 2007 5:32 pm
by richdhan
Hi All,

I have to use the loop functionality based on the number of records in a File.

I used the ExecuteCommand activity with wc -l command.

In the start loop, the loop type is Numeric. Start is 1, Step is 1 and End is #Execute_Command_0.$CommandOutput#

I got the following error

LoopingSeq..JobControl (@StartLoop_Activity_3): Controller problem: Loop final value not numeric (13 /myfolder/filename.txt) - cannot execute

I used the UserVariable activity and gave the following derivation Field(Execute_Command_0.$CommandOutput," ",1). I mapped #UserVariables_Activity_13.New# to the Start loop end value and it worked perfect.

I want to find out how I can do this directly with the ExecuteCommand activity output without using UserVariable activity.

TIA
--Rich

Posted: Mon Nov 19, 2007 5:58 pm
by chulett
Don't recall if this is supported, but did you try your new derivation without the UserVariables stage, directly in the Start Loop?

Field(Execute_Command_0.$CommandOutput," ",1)

Posted: Mon Nov 19, 2007 7:34 pm
by ray.wurlod
Don't forget that you have to strip the line terminator off.

Code: Select all

Trim(Convert(@FM,"",Execute_Command_0.$CommandOutput))