?
Solved

FIlter a SPRY XML file with Querystring from Parent Page

Posted on 2007-12-06
3
Medium Priority
?
318 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
hielo earned 200 total points
ID: 20421017
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
ID: 20426579
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
ID: 20426684
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
Suggested Courses

770 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