[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

FIlter a SPRY XML file with Querystring from Parent Page

Posted on 2007-12-06
3
Medium Priority
?
319 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

650 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