Author |
Topic |
|
frank.hisker
Germany
Posts |
Posted - 05/11/2011 : 11:00:59 AM
|
Origin Ver. 7.5 and Service Release 1(Select Help-->About Origin): Operating System: XP I want to delete rows of a worksheet by using
window -a fitten2; ii=0; number=500; //Falls im Originalfile weniger zeilen vorhanden sind, muss die Zahl verringert werden for(ii=number;ii>-1;ii--) { if (fitten2_Weg[ii]<=0) { mark -dc fitten2_Weg -b ii -e ii} }; // Wichtig Wie der For befehl aufgebaut ist
This deletes not the ros, but the cell. If I use that commands in a script there will be 2 columns left instead of five. What can I do |
|
greg
USA
1378 Posts |
Posted - 05/13/2011 : 10:44:07 AM
|
Without a project in hand to see the problem, I cannot say for sure, but I notice one problem with your script:
for(ii=number;ii>-1;ii--) {
0 is not an allowed row index in LabTalk (OriginC starts with zero) so the last execution of the loop will cause an error.
try ii>0 or ii>=1
|
|
|
LaurP
Estonia
16 Posts |
Posted - 11/28/2012 : 06:56:05 AM
|
Is there a way to make this nice?
I have copied a row from a sheet and want to delete the same sheet there. i is the index for row. Right now I have to point out every column. Is there anyway that I could straightly point out a row?
range delWL = 1[i]; del delWL; range delWLSE = 2[i]; del delWLSE; range delA = 3[i]; del delA; range delASE = 4[i]; del delASE; range delW = 5[i]; del delW; range delWSE = 6[i]; del delWSE; range delBN = 7[i]; del delBN; range delTemp = 8[i]; del delTemp; range delFPN = 9[i]; del delFPN; |
|
|
Kathy_Wang
China
159 Posts |
Posted - 11/28/2012 : 9:18:20 PM
|
quote: Originally posted by LaurP
Is there a way to make this nice?
I have copied a row from a sheet and want to delete the same sheet there. i is the index for row. Right now I have to point out every column. Is there anyway that I could straightly point out a row?
range delWL = 1[i]; del delWL; range delWLSE = 2[i]; del delWLSE; range delA = 3[i]; del delA; range delASE = 4[i]; del delASE; range delW = 5[i]; del delW; range delWSE = 6[i]; del delWSE; range delBN = 7[i]; del delBN; range delTemp = 8[i]; del delTemp; range delFPN = 9[i]; del delFPN;
Hi,
To delete an entire row, you could use the syntax:
range ra=[Book1]Sheet1![i]: [i];//i is the row index
del ra;
Kathy Originlab |
|
|
LaurP
Estonia
16 Posts |
Posted - 11/29/2012 : 07:16:14 AM
|
Thanks!
Can I copy a row same way? |
Edited by - LaurP on 11/29/2012 07:16:30 AM |
|
|
Kathy_Wang
China
159 Posts |
Posted - 11/29/2012 : 7:56:21 PM
|
quote: Originally posted by LaurP
Thanks!
Can I copy a row same way?
Yes, you could use the same syntax to copy a row with the copydata x function, an example would be:
range ri=[Book1]Sheet1![3]:[3];//Define input row as row 3
range rj=[Book1]Sheet1![4]:[4];//Define output row as row 4
copydata irng:=ri orng:=rj//Copy data from input to output
Kathy Originlab |
|
|
LaurP
Estonia
16 Posts |
Posted - 11/30/2012 : 06:31:16 AM
|
SuperThanks!
The only thing is that it doesn't copy the word cells (string cells?). Only copies the values.
As I understand then for letter cells I have to copy with strings? Or is there a way to adjust this so that it copies also word cells? |
|
|
Kathy_Wang
China
159 Posts |
Posted - 12/02/2012 : 7:49:42 PM
|
quote: Originally posted by LaurP
SuperThanks!
The only thing is that it doesn't copy the word cells (string cells?). Only copies the values.
As I understand then for letter cells I have to copy with strings? Or is there a way to adjust this so that it copies also word cells?
The copydata x-function is used only for numeric data, in case of text data, you could use the wrcopy x function, which is used to copy a range of cells from one worksheet to another(and the output can also be the same worksheet).
For example, the following script copies the first row in Book1, Sheet1 to the third row in the same worksheet:
wrcopy iw:=[Book1]Sheet1! ow:=[Book1]Sheet1! c1:=1 c2:=0 r1:=1 r2:=1 dc1:=1 dr1:=3;
Kathy Originlab |
|
|
Sell
Germany
20 Posts |
Posted - 01/09/2013 : 12:20:02 PM
|
After importing data, I would like to delete the indicated rows.
range ra=[Book1]Sheet1![1]: [13];//i is the row index del ra;
This works perfect if I indicate book and sheet. But what to do if I just imported data in a new workbook. How can I reference in the skript to the names of book and sheet. %H is just the name of the window. I need to get the hooks for the book and the sheet.
Thanks for your help |
|
|
greg
USA
1378 Posts |
Posted - 01/09/2013 : 4:34:01 PM
|
Anytime you are declaring a range, you can omit any default values. So after an import, the active Workbook is the default Book and the active worksheet is the default Sheet:
range ra = [1]:[13]; del ra;
If you look at the range you just declared ( list a ) you will see it contains the full notation.
Of course you can refer to properties also:
range ra = [%(page.name$)]%(layer.name$)![1]:[13]; del ra; |
|
|
Sell
Germany
20 Posts |
Posted - 01/10/2013 : 06:18:51 AM
|
worked perfekt! Thank you also for the hints with "list a" and "%(page.name$)" and "%(layer.name$)". |
|
|
|
Topic |
|