GeneratHTML Filter Questions

Using the data server (all products)

GeneratHTML Filter Questions

Postby JSonnabend1 » Sun Aug 16, 2009 10:54 pm

1. Is the filter always the token between the "?" and the first "@" in a url?

2. If a url has no filter, the previous filter is always presumed?
JSonnabend1
 
Posts: 1433
Joined: Thu Jul 31, 2003 8:21 pm

Re: GeneratHTML Filter Questions

Postby FredrikN » Mon Aug 17, 2009 11:08 am

JSonnabend1 wrote:1. Is the filter always the token between the "?" and the first "@" in a url?

No, not necessarily.

2. If a url has no filter, the previous filter is always presumed?

No, without a filter you get an error.
User avatar
FredrikN
Site Admin
 
Posts: 13727
Joined: Fri Nov 22, 2002 3:52 pm

Re: GeneratHTML Filter Questions

Postby JSonnabend1 » Mon Aug 17, 2009 3:25 pm

Ok, how do you determine what the filter is, then?

As for #2, your answer doesn't make sense. Valid URL's in the XSL files don't always have filters in them. Some are simply the name of the template. For example, the stock track.xsl template includes the link: "Track_Credits.xsl". There's no filter specified there.

- Jeff
JSonnabend1
 
Posts: 1433
Joined: Thu Jul 31, 2003 8:21 pm

Re: GeneratHTML Filter Questions

Postby hamsen » Mon Aug 17, 2009 7:05 pm

JSonnabend1 wrote:Ok, how do you determine what the filter is, then?

As for #2, your answer doesn't make sense. Valid URL's in the XSL files don't always have filters in them. Some are simply the name of the template. For example, the stock track.xsl template includes the link: "Track_Credits.xsl". There's no filter specified there.

- Jeff


Please look at the code I sent you (explorer.pas).
Look for the handling of SaveTemplate and SaveFilter.
Kind regards
Thomas Hamstrup

HAP Software (http://www.hamstrup.dk)

Using Windows 8 PRO 64-bit and CATraxx 9.44
User avatar
hamsen
 
Posts: 2572
Joined: Sat Nov 22, 2003 7:47 pm
Location: Denmark

Re: GeneratHTML Filter Questions

Postby JSonnabend1 » Mon Aug 17, 2009 7:19 pm

Ok, how do you handle the situation I posted above for the link to "Track_Credits.xsl" in "Track.xsl"?

I have my code working for some time now, I'm just not sure I'm doing things the most efficient way.

- Jeff
JSonnabend1
 
Posts: 1433
Joined: Thu Jul 31, 2003 8:21 pm

Re: GeneratHTML Filter Questions

Postby hamsen » Mon Aug 17, 2009 7:49 pm

JSonnabend1 wrote:Ok, how do you handle the situation I posted above for the link to "Track_Credits.xsl" in "Track.xsl"?

I have my code working for some time now, I'm just not sure I'm doing things the most efficient way.

- Jeff


In function TFrmExplorer.GetCATraxxData the Filter is saved to SaveFilter (conditional).

if not NoSave then
begin
SaveTemplate:=Template;
SaveFilter:=Filter;
end;

In procedure TFrmExplorer.ViewerHotSpotClick the various possibilities is checked.
In this case (Track_Credits.xsl) it will be trapped here:

if ContainsStr(URL, '.xsl') then
begin
Template:=HAPgetToken(URL,'?',1);
Filter:=Copy(URL,Length(Template) + 2,
Length(URL) - Length(Template) - 1);
if Filter = '' then Filter:=SaveFilter;
end

Since there is no filter, SaveFilter is used.
SaveFilter will contain "ID=1"

Hope that helps.
Kind regards
Thomas Hamstrup

HAP Software (http://www.hamstrup.dk)

Using Windows 8 PRO 64-bit and CATraxx 9.44
User avatar
hamsen
 
Posts: 2572
Joined: Sat Nov 22, 2003 7:47 pm
Location: Denmark

Re: GeneratHTML Filter Questions

Postby JSonnabend1 » Mon Aug 17, 2009 8:18 pm

Why would ID=1? What if that's not the id of the track being displayed in the track.xsl template?

Do this. Bring up track.xsl?id=2. Now click on the link linking to Track_Credits.xsl. The link is:
Code: Select all
<A HREF="Track_Credits.xsl">Credits</A>

That's valid in the Catraxx explorer (it's even from a default template). How does your code handle that?

- Jeff

Oh, I see. You're using "ID=1" as an example. You save the last filter, and if there's no new filter, you use the last filter. That's what I'm doing, although it gets tough if you're tracking multiple connections (each with its own filter).
JSonnabend1
 
Posts: 1433
Joined: Thu Jul 31, 2003 8:21 pm

Re: GeneratHTML Filter Questions

Postby FredrikN » Tue Aug 18, 2009 11:32 am

JSonnabend1 wrote:Ok, how do you determine what the filter is, then?

That is not difficult. Is something not working correctly?

As for #2, your answer doesn't make sense.

Not? Trying to generate either a record or list page without a filter will result in an error ("invalid record id" or "no filter criteria").

Valid URL's in the XSL files don't always have filters in them. Some are simply the name of the template. For example, the stock track.xsl template includes the link: "Track_Credits.xsl". There's no filter specified there.

That is because the explorer module keeps track of the record id of the "active" record, and automatically uses this id as the filter when linking to a record page if a filter is not specificed. If you want to use the standard templates, you have to do this yourself.
User avatar
FredrikN
Site Admin
 
Posts: 13727
Joined: Fri Nov 22, 2002 3:52 pm

Re: GeneratHTML Filter Questions

Postby JSonnabend1 » Tue Aug 18, 2009 2:22 pm

Exactly. If the URL has not filter specified, the explorer module uses the last good filter. The URL has no filter, though, and no error is specified. That was my question.

- Jeff
JSonnabend1
 
Posts: 1433
Joined: Thu Jul 31, 2003 8:21 pm

Re: GeneratHTML Filter Questions

Postby FredrikN » Tue Aug 18, 2009 3:01 pm

JSonnabend1 wrote:Exactly. If the URL has not filter specified, the explorer module uses the last good filter.

Only for record pages, though.

The URL has no filter, though, and no error is specified. That was my question.

I thought you were talking about the data server, not the explorer module...
User avatar
FredrikN
Site Admin
 
Posts: 13727
Joined: Fri Nov 22, 2002 3:52 pm

Next

Return to Data Server

cron