The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Error when getting column index for plotting

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Clairekun Posted - 07/29/2022 : 11:26:22 PM
Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win10

Hello,

I have several workbooks with mutiple columns each. I need to plot the columns Si, Al and Ca, but they don't always have the same column index. So I wrote the following code:

loop (ii,1,ArrSamples.GetSize()) //ArrSamples is a string array holding all workbook names
{
	//Define columns with range variables
	range rAl = "Al";
	range rSi= "Si";
	range rCa = "Ca";	
	string strSi$ = [%(ArrSamples.GetAt(ii)$)]%(ArrSamples.GetAt(ii)$)!($(rAl.index),$(rSi.index),$(rCa.index));

	//The string sNameG_SiTemp$ is the graph name, defined somewhere else.
	//The code generates a new ternary graph if the name doesn't exist; if it does, it creates a new scatter plot in the same layer
	if (Exist(%(sNameG_SiTemp$),3) == 0) outTern$ = <new template:=ternary>;
	else outTern$ = 1!;
	win -a %(ArrSamples.GetAt(ii)$); //Activate book with item index (ii)
	plotxyz iz:=%(strSi$) plot:=245 ogl:=[%(sNameG_SiTemp$)]%(outTern$);
}

After creating the first graph, the following error appears:
quote:
RAL.INDEX: error setting property value!
RSI.INDEX: error setting property value!
RCA.INDEX: error setting property value!
Failed to resolve range string, VarName = iz, VarValue = [A550C360d1p5z]A550C360d1p5z!(--,--,--)

If I test strSi$ (excluding the plotting part of the code), the column indexes show just fine for all workbooks. It is only when I try to plot it that it magically can't find them anymore.

If I set fixed index numbers, i.e. (2,3,4) instead of the range-based indexes, it works perfectly; however, the column indexes aren't always the same.

I feel like the solution is obvious but I can't find why the code isn't working.

Thank you.
2   L A T E S T    R E P L I E S    (Newest First)
Clairekun Posted - 08/04/2022 : 8:07:35 PM
That was it, thank you!
Castiel Posted - 07/30/2022 : 11:30:00 PM
quote:
Originally posted by Clairekun

Origin Ver. and Service Release (Select Help-->About Origin): 2018b
Operating System: Win10

Hello,

I have several workbooks with mutiple columns each. I need to plot the columns Si, Al and Ca, but they don't always have the same column index. So I wrote the following code:

loop (ii,1,ArrSamples.GetSize()) //ArrSamples is a string array holding all workbook names
{
	//Define columns with range variables
	range rAl = "Al";
	range rSi= "Si";
	range rCa = "Ca";	
	string strSi$ = [%(ArrSamples.GetAt(ii)$)]%(ArrSamples.GetAt(ii)$)!($(rAl.index),$(rSi.index),$(rCa.index));

	//The string sNameG_SiTemp$ is the graph name, defined somewhere else.
	//The code generates a new ternary graph if the name doesn't exist; if it does, it creates a new scatter plot in the same layer
	if (Exist(%(sNameG_SiTemp$),3) == 0) outTern$ = <new template:=ternary>;
	else outTern$ = 1!;
	win -a %(ArrSamples.GetAt(ii)$); //Activate book with item index (ii)
	plotxyz iz:=%(strSi$) plot:=245 ogl:=[%(sNameG_SiTemp$)]%(outTern$);
}

After creating the first graph, the following error appears:
quote:
RAL.INDEX: error setting property value!
RSI.INDEX: error setting property value!
RCA.INDEX: error setting property value!
Failed to resolve range string, VarName = iz, VarValue = [A550C360d1p5z]A550C360d1p5z!(--,--,--)

If I test strSi$ (excluding the plotting part of the code), the column indexes show just fine for all workbooks. It is only when I try to plot it that it magically can't find them anymore.

If I set fixed index numbers, i.e. (2,3,4) instead of the range-based indexes, it works perfectly; however, the column indexes aren't always the same.

I feel like the solution is obvious but I can't find why the code isn't working.

Thank you.


Activate your target worksheet before defining ranges.


------------------------------------------
       Be The Change
             You Want To See
                   In The World
------------------------------------------

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000