| T O P I C R E V I E W |
| jonni |
Posted - 10/16/2003 : 2:09:11 PM Hi,
Can anyone help resolve the following. The following script does not work due to data$(ii) not being able to be used as winName in [winName]!wks.addcol(). You should see what I am trying to do in the script -- I have a series of datasets with the name a055sXXX where XXX is 001,002,003,etc and want to do some simple operation to all sets.
for (ii=1;ii<=100;ii++) { if (ii<10) { a055s0$(ii)!wks.addcol(); a055s00$(ii)_c=a055s00$(ii)_b/1.3E-3; }; if (ii>=10 && ii<100) { a055s0$(ii)!wks.addcol(); a055s0$(ii)_c=a055s0$(ii)_b/1.3E-3; }; if (ii>=100) { a055s$(ii)!wks.addcol(); a055s$(ii)_c=a055s$(ii)_b/1.3E-3; }; }
Is it true that such substitution does not work? How can I correct this? Any additional simplification to the script possible?
Many thanks.
jonni
|
| 3 L A T E S T R E P L I E S (Newest First) |
| jonni |
Posted - 10/17/2003 : 1:51:24 PM Hi Mike and Tilman,
Thank you for your suggestions -- they both work beautifully.
Best regards,
jonni |
| tib |
Posted - 10/17/2003 : 01:53:01 AM Hi jonni, this might be another solution for your task:
doc -e W { // scan all wks in project %H holds wks name; if (%[%H,6]=="a055s") { // check if wks starts with your name; %H!wks.addcol(); // add column; %H_c=%H_b/1.3E-3; // do calculation; }; };
hope this helps and simplifies... Tilman.
|
| Mike Buess |
Posted - 10/16/2003 : 5:20:24 PM Hi jonni,
There was a topic very similar to this a few months ago but I can't find it now. As I recall, the solution was to use an intermediate string variable as shown below.
for (ii=1;ii<=100;ii++) { if (ii<10) { %A=a055s00$(ii); %A!wks.addcol(); %A_c=%A_b/1.3E-3; }; if (ii>=10 && ii<100) { %A=a055s0$(ii); %A!wks.addcol(); %A_c=%A_b/1.3E-3; }; if (ii>=100) { %A=a055s$(ii); %A!wks.addcol(); %A_c=%A_b/1.3E-3; }; }
Hope that helps.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 10/16/2003 5:22:47 PM
Edited by - Mike Buess on 10/16/2003 5:25:46 PM |