| T O P I C R E V I E W |
| uli_15 |
Posted - 12/10/2008 : 11:12:46 AM Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6 Operating System: Win XP SP2
Hello,
I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column. Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work. And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.
If it would be numeric, I could access it via $(parameter_names[j]) but this does unfortunately not work.
Can you help?
Regards, Uli |
| 4 L A T E S T R E P L I E S (Newest First) |
| uli_15 |
Posted - 12/18/2008 : 05:04:16 AM quote: Originally posted by uli_15
Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6 Operating System: Win XP SP2
Hello,
I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column. Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work. And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.
If it would be numeric, I could access it via $(parameter_names[j]) but this does unfortunately not work.
Can you help?
Regards, Uli
Hello VincentLiu,
just yesterday I found the fault which was to use namepara_ame[j] instead of namepara_ame[j]$. By the way, the comparison %[%H,5]==namepara_ame[j]$ works fine in my script, but I will change it now to "%[%H,5]"=="namepara_ame[j]$"
Thanks a lot for your support, Uli |
| VincentLiu |
Posted - 12/18/2008 : 04:13:49 AM Hi Uli
You may try to replace your codes with following codes:
doc -e W
{
%A = %[%H,5]; // part name of the Current worksheet
for (j=1;j<AnzahlDateien;j+=1)
{
%B = namepara_ames[j]$; //The 1st column's name is "ames";
if("%A"=="%B")
{
%W = namepara_5thCol[j]$;//Assume the 5th column's name is "5thCol";
type -c %W;
wks.col2.label$=%W;
wks.col3.label$=%W;
}
}
}
To use the codes, please first change the 5th column's name "5thCol" to the real name.
Please pay attention to the following things:
1. To know more about accessing the dataset elements, please select Help-> Programming-> LabTalk Language Reference-> Overview of the LabTalk Language-> Data Types-> Datasets-> Accessing Dataset Elements. In that page, you can see there are 4 different methods to access the cell contents.
2. To know more about comparing strings, please select Help-> Programming-> LabTalk Language Reference-> Overview of the LabTalk Language-> Data Types-> String Variables-> String Comparison. According to this, we need to write the comparison line to "%A" ="%B", not %A = %B.
3. You missed a ")" in the beginning of "if" structure in original codes.
Hope these can be helpful.
Best regards, Vincent Liu OriginLab Technical Services
|
| uli_15 |
Posted - 12/16/2008 : 04:59:04 AM [quote]Originally posted by uli_15
Origin Ver. and SR (Select Help-->About Origin): 7.5 SR6 Operating System: Win XP SP2
Hello,
I have a worksheet "parameter" which contains names in the first column (which has the column name "names" as well) and values of parameters in the other columns. For example, I have "n266" in the first column. Imagine I have another worksheet named "n266at1V". After extracting teh first 4 characters, i.e. "n266", I would like to find the corresponding paramter values by comparing the string "n266" with the content of the first column of the wks "parameter". However, I do net get it to work. And it seems to be independent of the nature of the first column in "parameter", i.e. if it is an X, Y or caption type column.
If it would be numeric, I could access it via $(parameter_names[j]) but this does unfortunately not work.
Can you help?
Regards, Uli
Hello Vincent Liu,
I cannot paste all the code cause it is a rather large script. I will try to explain the part of the code I pasted below. Within the script, a worksheet "namepara" is created which contains names in the first column and values (of parameters) in the other columns. The names in the first columns are from the type "n123". And there are worksheets with data (which is also plotted) which have names like e.g. "n123at1V". As I would like to sort the project by putting worksheets and corresponding graphs into subfolders, I would like to use a loop where the name of a worksheet (e.g. "n111at0V") or rather the first 4 characters ("n111") is compared with the content of the first column of "namepara".
This part of the code is: >>>
j=1; doc -e W { for (j=1;j<AnzahlDateien;j+=1) { if(%[%H,5]==namepara(1)[j] { type -c namepara(5)[j]; wks.col2.label$=namepara(5)[j]; wks.col3.label$=namepara(5)[j]; }; };
>>>
Therein, AnzahlDateien is just the number of worksheets. The problem is that I cannot access the information namepara(1)[j]. The name of the first column is "ame", so I also tried namepara_ame[j] but did not succeed.
I hope I could make it more clear...
Regards, Uli |
| VincentLiu |
Posted - 12/11/2008 : 12:58:03 AM Hi Uli,
Could your paste your codes here? Or you can send your codes through
http://www.originlab.com/www/company/qform.aspx?s=1&
Then we can see whether can solve the problem.
Best regards, Vincent Liu OriginLab Technical Services
|
|
|