Page 1 of 1
Auto increment column
Posted: Thu Jul 07, 2016 1:55 am
by kaktusman69
Hello.
I need to create a column with auto increment, depending of the lines in Data Band.
Here is the solution for a simple MySQL query,
http://stackoverflow.com/questions/1186 ... d-in-the-r, how can i adapt this functionality in a StimulSoft->DataSource->query.
Thanks,
Vadim
Re: Auto increment column
Posted: Thu Jul 07, 2016 6:00 am
by Alex K.
Hello,
You can use the system variable {Line} from the Dictionary on the data band for this task.
Thank you.
Re: Auto increment column
Posted: Thu Jul 07, 2016 1:25 pm
by kaktusman69
Hi Aleksey.
Thanks for the idea, but in my case i can't use.
For example: we have 'x' large chapters with subchapters, in a query, i make a "UNION" and receive the respective chapters with subchapters: [chapter 1 , chapter 2, ..., subchapter 1, ..., subchapter 10].
Now, i want to make a classification/ordering, to look like this:
1 Chapter 1
1.1 Subchapter 1
1.2 Subchapter 2
...
10 Chapter 10
10.1 Subchapter 10
...
In a simple MySQL query, i use the code from the link i've put above, but i can adopt to Data Source->query.
Thanks
Re: Auto increment column
Posted: Fri Jul 08, 2016 10:44 am
by Alex K.
Hello,
We need some additional time for investigating the issue. We will let you know about the result.
Thank you.
Re: Auto increment column
Posted: Mon Jul 11, 2016 8:33 am
by kaktusman69
Thank you much, let me know about results.
Re: Auto increment column
Posted: Tue Jul 12, 2016 9:23 pm
by Ivan
Hello,
Please check the sample report template in the attachment.
We used an additional variable and a script to organize autoincrement.
We do not have your data, so the example uses our database.
Let us know if you need any additional help.
Thank you.
Re: Auto increment column
Posted: Wed Jul 13, 2016 6:37 am
by Alex K.
Hello,
Also, you can use stored procedure for this task. In this case, you can create Stored Procedure for this task.
Code: Select all
CREATE DEFINER=`root`@`localhost` PROCEDURE `incrementSelect`()
BEGIN
SELECT @s:=@s+1 serial_number, product_name, list_price
FROM products,
(SELECT @s:= 0) AS s;
END
And then use in the data source as:
But in this case, in PHP version you need to add all columns manually. In JS(HTML5) version retrieve columns works correctly.
Thank you.