PDA

View Full Version : datasets


blmetz
03-02-2004, 02:45 AM
I have a question about datasets:

<dataset name="dsDataSet" src="http://somedomain/page.aspx" autorequest="false" type="http"/>

Is there any way to set the src dynamically?

The issue is this.....
On my development server the src="http://dev/page.aspx"
On my staging server the src="http://staging/page.aspx"
On my live servers the src="http://live/page.aspx"

Currently I have I have three sets of urls (dev, staging, live) which I have to comment and uncomment depending on the server.
Can these value be read from a file?
Is there a better solution, than commenting and uncommenting as the code is published?

antun
03-02-2004, 08:12 AM
Both setting it in script:


var mysrc = "http://somedomain/page.aspx";
dsDataSet.setAttribute( "src", mysrc );


... and constraining the src attribute to some global variable (e.g. of the canvas) ...


<attribute name="dssrc" value="testdata.xml"
type="string" />

<dataset name="dsDataSet" src="$once{canvas.dssrc}"
autorequest="false" type="http" />


... should work. There is probably a setSrc() method of dataset as well.

-Antun

blmetz
03-02-2004, 08:41 AM
Antun,

I'm not sure I understand the reply. It appears to me in the examples the "scr" is being set to the literal string "testdata.xml". Is this correct?

I would like to read a file to set the "scr".
The reference would need to be relative to LSP.

I need something outside the canvas, like an external file which would hold different URLs depending on which server I was on.

Any ideas at all would be greatly appreciated.

Thanks,
Brian

antun
03-02-2004, 09:35 AM
I need something outside the canvas, like an external file which would hold different URLs depending on which server I was on.


You can't just read raw text from a regular text file. Instead you can have an XML file that contains your URLs.

You could constrain the src attribute of the dataset to some value (retrieved via XPath) from your urls file:


<canvas>
<dataset name="dsmyurl" src="myurls.xml" />
<dataset name="mydataset" type="http"
src="$path{'dsmyurl:/myroot/@urltouse'}" />


-Antun