Solved

FIlter a SPRY XML file with Querystring from Parent Page

Posted on 2007-12-06
3
311 Views
Last Modified: 2013-11-12
Hello All,

I'm trying to do something simple, but for the life of me I can't get it to work out for me.  I'm new to SPRY for AJAX and my javascript is next to non-existant.

I have a normal ASP page passing a URLparam to another ASP page using an externally generated XML file.  I want this external XML to use the URL param to filter its recordset.

The external XML has a normal recordset behavior and the XML is generated in a Repeat Region.

I tried to include the URL param in the XML file recordset, but I don't think this XML can see the URL param.

Looking forward to hear from some Experts!!

0
Comment
Question by:jkdunbar
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 50 total points
Comment Utility
It would help if you provided the XML structure and the filter parameter. But to give you an idea, lets your xml looks similar to this:
<states>
 <state abbr="CA" name="California">Hi</state>
 <state abbr="OR" name="Oregon">Bye</state>
</states>
and you want to get only California's data, then you would do it as follows:
var dsStates1 = new Spry.Data.XMLDataSet("states.xml", "/states/state[@abbr='CA']");
0
 
LVL 1

Author Comment

by:jkdunbar
Comment Utility
This is the URL param I'm trying to pass to this page:
/image_gallery/images.asp?image_function=Retirement

The following is a snippet of my XML:

- <pictures>
- <image>
  <ID1>108</ID1>
  <image_category>Events</image_category>
  <image_function>Retirement</image_function>
  <image_path>/CFPU/Upload/../images/uploaded/27.jpg</image_path>
  <image_desc>Enter a description for this image</image_desc>
  <photo_year>2003</photo_year>
  <image_unit>CFPU HQ</image_unit>
  <approved>True</approved>
  <submitted>Dunbar</submitted>
  </image>
</pictures>

Thanks for pointing me in the right direction... maybe I can read up on this too.
0
 
LVL 1

Author Comment

by:jkdunbar
Comment Utility
Got it!!!  I used this code as an example and modified it for my site:

 var params = Spry.Utils.getLocationParamsAsObject();

 var xpath = "/employees/employee";

   if ((params.lastname) && (params.firstname))
   xpath = "/employees/employee[lastname = '"+params.lastname+"' and firstname= '"+params.firstname+"']";
   
   var ds1 = new Spry.Data.XMLDataSet("../../data/employees-01.xml", xpath);


Works like a charm!!

I will still give you the 50 points for helping me to go in the right direction!!

Cheers!

Kev.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Introduction In this tutorial, I'll explain how to create an animated progress meter in a wireframe prototype developed using Axure RP 7.0 - a leading prototyping tool for designing web sites and software. (For more information about Axure and gett…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now