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
 %() Substitution gives inconsistent Range Strings

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
AlexD2 Posted - 01/10/2014 : 2:18:11 PM
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
1   L A T E S T    R E P L I E S    (Newest First)
AlexD2 Posted - 01/12/2014 : 04:49:01 AM
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.

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