Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Interchange: users

if explicit problem with data tag

 

 

Interchange users RSS feed   Index | Next | Previous | View Threaded


lists at gmnet

Nov 21, 2009, 11:36 AM

Post #1 of 4 (939 views)
Permalink
if explicit problem with data tag

Hi,

The following works perfect:

[if type=explicit compare="$Tag->scratch({ name => test_[data session arg], })"]
...

However, the next case produces an Internal Server Error with nothing in
the logs:

[.if type=explicit compare="$Tag->data({ table => groups, column => description, key => [data session arg], })"]
...

The groups table with the description in the above example is a
customization, but I assure that it is a perfectly valid table etc...
Basically I am trying to see if there is any data at all in the
description column of the groups table based on the session arg.

Any ideas what the problem is? Or maybe there is a better way to test
this?

Thanks
Rick





--
This message has been scanned for viruses and
dangerous content by Green Mountain Network, and is
believed to be clean.


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


db at endpoint

Nov 21, 2009, 12:28 PM

Post #2 of 4 (893 views)
Permalink
Re: if explicit problem with data tag [In reply to]

On Saturday 21 November 2009 11:36:56 am Rick Bragg wrote:
> [.if type=explicit compare="$Tag->data({ table => groups
> column => description, key => [data session arg], })"] ...
> Any ideas what the problem is?

Here is what I suggest as a replacement:

[if type=data term="groups::description::[data session arg]"]

If you're curious why the first version didn't work, there are several
reasons. When you pass perl to a usertag, it helps to try executing that
perl by itself first to check for problems, like so:

[perl]
return $Tag->data(
{
table => groups
column => description,
key => [data session arg],
}
);
[/perl]

That will show you the syntax errors (missing comma, unquoted literals,
table access). Here is the fixed code:

[perl tables="groups"]
return $Tag->data(
{
table => 'groups',
column => 'description',
key => q{[data session arg]},
}
);
[/perl]

Then you could package that up and put it back in the compare="" clause, if
you could not use this shorter version for some reason:

[if type=data term="groups::description::[data session arg]"]

HTH,
--
Daniel Browning
End Point Corporation
http://www.endpoint.com/

_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


lists at gmnet

Nov 21, 2009, 3:08 PM

Post #3 of 4 (882 views)
Permalink
Re: if explicit problem with data tag (SOLVED) [In reply to]

On Sat, 2009-11-21 at 12:28 -0800, Daniel Browning wrote:
> On Saturday 21 November 2009 11:36:56 am Rick Bragg wrote:
> > [.if type=explicit compare="$Tag->data({ table => groups
> > column => description, key => [data session arg], })"] ...
> > Any ideas what the problem is?
>
> Here is what I suggest as a replacement:
>
> [if type=data term="groups::description::[data session arg]"]
>
> If you're curious why the first version didn't work, there are several
> reasons. When you pass perl to a usertag, it helps to try executing that
> perl by itself first to check for problems, like so:
>
> [perl]
> return $Tag->data(
> {
> table => groups
> column => description,
> key => [data session arg],
> }
> );
> [/perl]
>
> That will show you the syntax errors (missing comma, unquoted literals,
> table access). Here is the fixed code:
>
> [perl tables="groups"]
> return $Tag->data(
> {
> table => 'groups',
> column => 'description',
> key => q{[data session arg]},
> }
> );
> [/perl]
>
> Then you could package that up and put it back in the compare="" clause, if
> you could not use this shorter version for some reason:
>
> [if type=data term="groups::description::[data session arg]"]
>
> HTH,
> --
> Daniel Browning
> End Point Corporation
> http://www.endpoint.com/
>

Yes Dan that did Help!

My first try was:
[if type=data term=groups::description::[scratch test]] (no quotes)
That did not work, so I went to the perl thing, but now with:
[if type=data term="groups::description::[scratch test]"]
things work perfect.

Thanks
Rick





--
This message has been scanned for viruses and
dangerous content by Green Mountain Network, and is
believed to be clean.


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users


pajamian at pajamian

Nov 21, 2009, 3:16 PM

Post #4 of 4 (883 views)
Permalink
Re: if explicit problem with data tag [In reply to]

On 22/11/09 08:36, Rick Bragg wrote:
> Hi,
>
> The following works perfect:
>
> [if type=explicit compare="$Tag->scratch({ name => test_[data session arg], })"]

I can't see how that would work, perl arguments must be quoted, for example:

[if type=explicit compare="$Tag->scratch({ name => 'test_[data session
arg]' })"]

but it would be better to do any of the following (in increasing order
of bad to best):
[if type=explicit compare="$Tag->scratch('test_[data session arg]')"]
[if type=explicit compare="$Scratch->{"test_$Session->{arg}"}"]
[if type=scratch term="test_[data session arg]"]

> However, the next case produces an Internal Server Error with nothing in
> the logs:
>
> [.if type=explicit compare="$Tag->data({ table => groups, column => description, key => [data session arg], })"]

Again, problem with quoting args in perl, but you also have the problem
that the groups table may not be open at the time this code is run. You
need to ensure it is by opening the table above the [if] tag:
[perl groups][/perl]
[if type=explicit compare="$Tag->data('groups', 'description',
$Session->{arg})"]

...but far better is to simply do this (no need to open the table this way):
[if type=data term="groups::description::[data session arg]"]

Peter


_______________________________________________
interchange-users mailing list
interchange-users [at] icdevgroup
http://www.icdevgroup.org/mailman/listinfo/interchange-users

Interchange users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.