Page 1 of 1

How to create a parameter against a relation data field

Posted: Fri May 19, 2017 4:18 pm
by nexar
I have the following data schema:

Code: Select all

<Tours>
  <id>
  <tourdesc>
  <tourcityid>
</Tours>

<Cities>
  <id>
  <citydesc>
  <countryid>
</Cities>

<Countries>
  <id>
  <countrydesc>
</Countries>
I have created a data source for each of these tables. I have then created a relationship for Tour_City and another City_Country.

Based on the above relationships I can extract the following information in a single data band as follows:

{Tours.id} {Tours.tourdesc} {Tours.Tour_City.citydesc} {Tours.Tour_City.City_Country.countrydesc}

I now need to provide a parameter where the user selects from the list of countries from the Countries.countrydesc and that brings up only those Tours which are in that country.

I created a variable called Country and linked it to the Data Column key = countries.id and value = countries.countrydesc. I now need to tell sql query to use this variable.....and that's the bit I can't do.

Please will you tell me how to do that.

Currently my query strings are :

select id,tourdesc, tourcityid, from tours.
select id, citydesc, countryid from cities.
select id, countrydesc from countries

All help gratefully received with thanks.

Re: How to create a parameter against a relation data field

Posted: Fri May 19, 2017 5:51 pm
by nexar
It's OK I've found out that the way to do this is to create a Filter on the Data band and then use the country.id through the relationships and make it equal to the variable. That then works fine.

However I would like to ONLY present a final pdf file to the client rather than via the viewer. I can arrange to request their choice of country.id via other programming ways. If I do that then how do I present to the report progammatically the filter parameter?

Thanks for your help.

Re: How to create a parameter against a relation data field

Posted: Mon May 22, 2017 6:23 am
by Alex K.
Hello,

You can use an additional variable which uses in the filter and set before rendering, exporting report.
You can find samples at the following link:
https://www.stimulsoft.com/en/samples/js

Thank you.

Re: How to create a parameter against a relation data field

Posted: Thu May 25, 2017 7:58 pm
by nexar
Hi Aleksey

I looked through all of the JS samples and I couldn't find any that dealt with parameters. There are a couple of videos which show how to work with parameters but not through code.

Please could you tell me which particular samples I should look at. Thanks.

Re: How to create a parameter against a relation data field

Posted: Fri May 26, 2017 6:17 am
by Alex K.
Hello,

You can use the following code to set the value for variable from code:

Code: Select all

report.dictionary.variables.getByName("variableName").valueObject = "your value";
Thank you.

Re: How to create a parameter against a relation data field

Posted: Fri May 26, 2017 9:09 am
by nexar
Thanks very much for that info Aleksey. I'll have a try.

I'm beginning to realise that there is a LOT MORE functionality within the software than is described in the documentation, samples or videos. Is there anywhere I can get at the 'Object' models for the JS version please? That would allow me to understand what other functionality I could use.

Re: How to create a parameter against a relation data field

Posted: Sun May 28, 2017 11:20 am
by Alex K.