DataSource

Stimulsoft Reports.PHP discussion
Post Reply
ChristianNRW
Posts: 6
Joined: Tue May 03, 2011 5:44 am
Location: Germany

DataSource

Post by ChristianNRW »

Hi.

if i generate some report fields from a mysql, i will create a statement like
SELECT FIELD FROM TABLE WHERE FIELDX = {param1}
param1 = URL GET Parameter.

But how can i use values, that i can't determining via SQL ?

In my case i like to do a report like this:

DATE | ADDRESS
DATE | ADDRESS
DATE | ADDRESS
...

Where ADDRESS is a location, based on the Longitude / Latitude Values From the DB.
the location service is done by a php Function.
So the ADDRESS Value is, and cannot be a DB Value.

In theory i can do this with a PHP generated XML File as whole datastore.
But the XML filename has to be static.
and that is on a session based, multiuser system unfortunate.

Any idea ?

BR
Christian
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

DataSource

Post by Andrew »

Hello,

Please clarify, do you need to use these values ​​in a report or in an SQL query? If it is in the report, then you can use report variables (which can also be used in the SQL query). If it is the SQL query, then you can set using the GET variables, and using the 'sti_get_parameter' function in the 'index.php' file.

Thank you.
ChristianNRW
Posts: 6
Joined: Tue May 03, 2011 5:44 am
Location: Germany

DataSource

Post by ChristianNRW »

Hi.

there are some values in my DB which i can't get from my DB, because they based on Values from the DB.
Example.
If i store a GeoLocation i will store the Longitude / Latitude from the Location, but not the City or Street Name .
To determine the City or Steet Names i am using a PHP Function based on a Location Service.

So:
How can i get those values in my Report ?

If i generate a XML File from my DB and GeoLocation it must have the same name, because filename cannot be dynamic.
And that is in a multiuser environment inpracticable.

If i will using your idea by using Variables via GET i had to enter it like this:
...param1=Bla&param2=Bli&param3=Blub
Parameter Count (param1 to paramX) has to be LineCount
Because each line has a City
That is a bit inpracticable.

i'm hopeful that decription clarifies the problem a bit

BR
Christian




Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

DataSource

Post by Vladimir »

Hello,

There is a way of solution.

1. Create two data sources: the first is SQL for retrieve geolocation data, and a second is XML for cities and streets names.
2. In the 'config.xml' file, set the 'FlexAdapterXmlData' parameter to False, this will allow you to dynamically create XML data using PHP script.
3. Edit 'sti_xml_get_columns' and 'sti_xml_get_data' function in the 'database_xml.php' file, so that they would return the dynamically generated names of cities and streets.

Thank you.
Post Reply