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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Error when getting column index for plotting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairekun

Germany
175 Posts

Posted - 07/29/2022 :  11:26:22 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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.

Castiel

343 Posts

Posted - 07/30/2022 :  11:30:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
------------------------------------------
Go to Top of Page

Clairekun

Germany
175 Posts

Posted - 08/04/2022 :  8:07:35 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That was it, thank you!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000