Trouble how store data with variables from database

Stimulsoft Reports.NET discussion
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hi All,
i am trying to perform a task in my report a bit complicated for me,when we compile the report and send it to the client many times the clients request to change some data so we should resend a new report but the trouble is the report contain a lot of data stored from the database and to remind it is hard so i saved the data of each report in the database via variables to remind each report done and the data used to do it;
now when the client request to change some data in the report we should open it and change the data but here i got stuck .
When i open the data of a report compiled in past i know how retrieve the data saved in database with Variables but with a single Value but when i need to populate a CheckListBoxControl with a Variables that contain more value i get stuck ;
I have a ChecklistBox populate in this way :

Code: Select all

if (ComboBoxControl1.SelectedIndex >= 0)
{
string index = Country_TBL.GetData("CountryCode", ComboBoxControl1.SelectedIndex).ToString();

   	CheckedListBoxControl1.Control.Items.Clear();
	City_TBL.First();

	while (!City_TBL.IsEof)
	{
		if (City_TBL.CountryCode == index)
		{
	    	CheckedListBoxControl1.Control.Items.Add(City_TBL.CityCode);
		}
		City_TBL.Next();
	}
}

this CheckedListBoxControl1 contain a list of City Code ,
now i wish check the items of the CheckedListBoxControl1 with a variable saved in the database that contain CityCode but i don't know the right way to do that .
It is the code of the variable saved in the database:

Code: Select all

where CityCode in ('NHA','PHT','SGN')  // CityCode is a field of a City_TBL
so i wish first populate CheckedListBoxControl1 with CheckedItems = false after i wish set CheckedItems =true of the CheckedListBoxControl1 with the CityCode present as the Variable above.

Do you have any help to perform this task?

If you need additional info let me know that :)

Thanks so much for your attention

Cheers

EDIT : If my trouble was not clear let me know i will try to explain it in better way or if my way to do is wrong ,can you advice me a right way ? Thanks so much

Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Trouble how store data with variables from database

Post by Alex K. »

Hello,

If we understand your problem correctly, then, in this case, since you have records about data for this report checked last time, then, as an option, you can add a query (Data source) from the database, which will select the values marked last time, and check the entry into CheckListBoxControl by this date source but not by a full table.

Thank you.
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hi Aleksey,
thanks for your reply,
if we understand your problem correctly, then, in this case, since you have records about data for this report checked last time, then, as an option, you can add a query (Data source) from the database, which will select the values marked last time, and check the entry into CheckListBoxControl by this date source but not by a full table.
infact it is the task i wish to do , i saved the variable in the database

Code: Select all

where CityCode in ('NHA','PHT','SGN')  // CityCode is a field of a City_TBL
so there are 50 CityCode but on Load i wish check in the CheckedListBox only the 3 CityCode as the query above('NHA','PHT','SGN') and UnCheck others 47 CityCode but here i get stuck.
Do you have an example to do that?
Thanks so much for your attention.

Have a good day.

Cheers
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hi i added the query to the DataSource in this way:

the Variable StoreCities retrieve the query from the database ;
StoreCities = where CityCode in('SGN','PQC')

Code: Select all

select * from City_TBL{StoreCities}
now using this variable the CheckeListBoxControl retrieve all CityCode in the City_TBL instead of 2 CityCode;

instead if i insert this code manually in the DataSource it retrieve the right CityCode ,example below :

Code: Select all

select * from City_TBL where CityCode in('SGN','PQC')
What i do wrong in this case?

Thanks so much for your attention.

Cheers
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Trouble how store data with variables from database

Post by Jan »

Hello,

If you want change report variable which used in report sql query during report rendering you need some additional steps:

1. Set property ConnectOnStart of data source to false.
2. In Click event of dialog form add following code:

Code: Select all

MyDataSource.Connect();
Thank you.
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hello,
i tried to follow your way bit i got not luck;
I set up in the property of the DataSource the property ConnectOnStart to false, after in the click event to populate the CheckedListBoxControl i add this code:

Code: Select all


StoreCities = txtCityVar.Text;


//City_TBL2.Connect();
if (ComboBoxControl1.SelectedIndex >= 0)
{
string index = Country_TBL.GetData("CountryCode", ComboBoxControl1.SelectedIndex).ToString();
	City_TBL2.First();
	while (!City_TBL2.IsEof)
	{
		if (City_TBL2.CountryCode == index)// + StoreCities.ToString())
		{
	    	CheckedListBoxControl11.Control.Items.Add(City_TBL2.CityCode);
	}
		City_TBL2.Next();
}
}
City_TBL2.Connect();

but the CheckedListBoxControl11 is blank ; i am trying to find out the reason ,if you have some advice it will be appreciate ,anyway thanks so much for your time.

Have a good time.

Cheers
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Trouble how store data with variables from database

Post by Alex K. »

Hello,

Please send us your report with data on support@stimulsoft.com for analisys.

Thank you.
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hi Aleksey,
i sent my report with data to the Stimulsoft.

Thanks so much.

Cheers
jjc
Posts: 97
Joined: Mon Apr 19, 2010 10:14 pm

Trouble how store data with variables from database

Post by jjc »

Hello ,
there are not news about this trouble?
Anyway i am trying to work out this task ,i need to report to my superior if it is possible or not 'cos it is the most important task about the report to modify .

Thanks so much .

Have a good day.

Cheers
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Trouble how store data with variables from database

Post by Alex K. »

Hello,

We work hard on this problem and do our best to do it as fast as possible. We will let you know when the solution is available.

Thank you.
Post Reply