Variable Variables

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Variable Variables

Peter Brown
Hi

I was wondering if it is possible to have variable variables, ie; naming
a variable after a variable or a field, eg:

(var:(field:'employee'))='blah'

or

(var:(var:'employee'))='blah';

I've triedbut I keep getting a lasso error


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.322 / Virus Database: 267.3.0 - Release Date: 30/05/2005


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Variable Variables

Pierre Laran
Le 31/05/05 14:55, « Peter Brown » <[hidden email]> a écrit :

> Hi
>
> I was wondering if it is possible to have variable variables, ie; naming
> a variable after a variable or a field, eg:
>
> (var:(field:'employee'))='blah'
>
> or
>
> (var:(var:'employee'))='blah';
>
> I've triedbut I keep getting a lasso error
>
Yes it should work, but for this:

    (var:(var:'employee'))='blah';

you could try :

    (var:$employee)='blah';

??


       

       
               
_____________________________________________________________________________
D?couvrez le nouveau Yahoo! Mail : 1 Go d'espace de stockage pour vos mails, photos et vid?os !
Cr?ez votre Yahoo! Mail sur http://fr.mail.yahoo.com

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Variable Variables

Douglas Burchard
In reply to this post by Peter Brown
On May 31, 2005, at 6:19 AM, Pierre Laran wrote:

> Yes it should work, but for this:
>
>     (var:(var:'employee'))='blah';
>
> you could try :
>
>     (var:$employee)='blah';

Should be:

     Var: $employees = 'blah';

or:

     (Var: $employees = 'blah');

your original attempt probably failed due to the misplaced parentheses.


--
Douglas Burchard, President
DouglasBurchard.com, Web Applications
15024 NE 66th Street
Redmond, WA  98052, USA

direct: (206) 227-8161
[hidden email]
http://www.douglasburchard.com/


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Variable Variables

jasonhuck
In reply to this post by Peter Brown
All of these work for me. Did I miss something?


[//lasso
        var: 'employee' = 'empName';
       
        (var: (var: 'employee')) = 'Bob';
       
        '1. ' + (var: (var: 'employee')) + '<br>\n';
       
        (var: $employee) = 'Gary';
       
        '2. ' + (var: $employee) + '<br>\n';
       
        var: $employee = 'Fred';
       
        '3. ' + (var: $employee) + '<br>\n';
       
        (var: $employee = 'Jane');
       
        '4. ' + (var: $employee) + '<br>\n';
]




On 5/31/05, Douglas Burchard <[hidden email]> wrote:

> On May 31, 2005, at 6:19 AM, Pierre Laran wrote:
>
> > Yes it should work, but for this:
> >
> >     (var:(var:'employee'))='blah';
> >
> > you could try :
> >
> >     (var:$employee)='blah';
>
> Should be:
>
>      Var: $employees = 'blah';
>
> or:
>
>      (Var: $employees = 'blah');
>
> your original attempt probably failed due to the misplaced parentheses.

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Variable Variables

Douglas Burchard
In reply to this post by Peter Brown
On May 31, 2005, at 9:46 AM, Jason Huck wrote:

> All of these work for me. Did I miss something?

Apparently, and perhaps it was Peter's original statement of "I've  
tried but I keep getting a lasso error". Since Pierre's suggestion of  
simply changing from (Var: 'employee') to $employee shouldn't have  
made any difference, something else must be wrong.

Yes, all of your code works fine on my system and yours, but  
obviously not on Peter's. Since [(Var: 'name') = 'value] clearly  
isn't correct to the docs ("...called with a name/value  
parameter..."), my guess is whatever version Peter is using isn't as  
forgiving in this respect (previous posts would suggest LP7 on  
Windows, but I have no idea which release).

Let's see what works for Peter.  :-)


--
Douglas Burchard, President
DouglasBurchard.com, Web Applications
15024 NE 66th Street
Redmond, WA  98052, USA

direct: (206) 227-8161
[hidden email]
http://www.douglasburchard.com/


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: Variable Variables

Fletcher Sandbeck
In reply to this post by Peter Brown
On 5/31/05 at 10:08 AM by [hidden email] (Douglas Burchard):

>Yes, all of your code works fine on my system and yours, but  
>obviously not on Peter's. Since [(Var: 'name') = 'value] clearly  
>isn't correct to the docs ("...called with a name/value  
>parameter..."), my guess is whatever version Peter is using isn't as  
>forgiving in this respect (previous posts would suggest LP7 on  
>Windows, but I have no idea which release).

The [Variable] tag can either be called with a name/value parameter to set a variable or with a name parameter to retrieve a variable value.  Variable values are retrieved by reference in Lasso.  (Var: 'name') is equivalent to $name.  Just as $name='new value' works to store a new value in $name so too will (var: 'name')='new value' work.

However, there can be subtle differences between using [Var: 'name' = 'value'] and [(Var: 'name') = 'value'].  All things being equal, I'd recommend using the former unless you know you need the latter.

[fletcher]
--
Fletcher Sandbeck                         [hidden email]
Lasso Product Specialist              [hidden email]
OmniPilot, Software Inc.                http://www.omnipilot.com

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage