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
 %() Substitution gives inconsistent Range Strings
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AlexD2

France
19 Posts

Posted - 01/10/2014 :  2:18:11 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release:
9.1.0 Sr1
Operating System:
Windows7 32 bit

I don't understand the behavior of the %() substitution:

With Book2 and Sheet1 active:
>>range rDa1 = %([Book2]Sheet1,1); type %(rDa1)
[Book2]Sheet1!Book2_A // OK

With Sheet3 active:
>>range rDa1 = %([Book2]Sheet1,1); type %(rDa1)
[Book2]Sheet3!Book2_A // ???

Shouldn't the result be independent of which Book/Sheet is active?


Similarly:
With Sheet3 active:
>>range rDa1 = %([Book2]Sheet3,1); type %(rDa1)
[Book2]Sheet3!Book2_A@2 // OK (I only have two sheets: Sheet1 and Sheet3)

With Sheet1 active:
>>range rDa1 = %([Book2]Sheet3,1); type %(rDa1)
[Book2]Sheet1!Book2_A@2 // Not good


What is also surprising is that the dataset name is correct in every case: I obtain Book2_A or Book2_A@2 as it should be; however the SheetName (Sheet1 or Sheet3) is inconsistent and depends on which worksheet is active.

Is this a normal behavior?

Thanks for your help!

AlexD2

AlexD2

France
19 Posts

Posted - 01/12/2014 :  04:49:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I answer my own question!

The %() substitution returns only the name of the dataset so in the second example, %([Book2]Sheet1,1) only returns Book2_A.
But in absence of a proper absolute range expression, the range declaration (range rDa1 = ...) appends the range of the active sheet (i.e. [Book2]Sheet3) in front of the right hand-side expression!

So the results are indeed logical.
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