Rows count variable

With the rows count enabled in the toolbar, there must already be a count of records going on. Is there any way to access a variable for this without having to do a select count(*) from the table again?

One thing you can try is create a simple application with Row count onā€¦
Open the Source code and Copy the code.
Turn off the Row Count and then copy that code.
Then go to Diffchecker - Compare text online to find the difference between two text files and paste the two side by side and see what the difference is. It may reveal the Session variable name.

Interesting idea. Will do that.

Report back if you find anything good!

The variable is $this->count_ger , itā€™s available in the onRecord event

1 Like

not finding that so how do you reference it. The only diff I found (other than session ID) is the following:
ā€œ^span class=ā€œsummary_indicator css_toolbar_objā€ style=ā€œborder:0px;ā€^^span class=ā€˜sm_counterā€™^[1 to ^span class=ā€˜sm_counter_finalā€™^10^/span^ of^span class=ā€˜sm_counter_totalā€™^32^/span^]^/span^^/span^ā€

The class and variable must actually be defined elsewhere. Note: had to replace all the >< with ^ so it wouldnā€™t take it here as a format instruction!!!

Itā€™s a local variable in onRecord event, just use it in your code or assign it to other variable

[variable] = $this->count_ger;
{variable} = $this->count_ger;

If you need it, the first record of the page is $this->nmgp_reg_inicial;
The last record is $this->nmgp_reg_final;

The current line (on screen) being process is $this->SC_seq_page;
the first line of the page is always 1, so to know what is the current record you need to

$CurrentRecord = $this->nmgp_reg_inicial + $this->SC_seq_page - 1;

Will experiment and report back! Thanks.

m

Is this still valid?
Iā€™m looking at an editable grid and trying to establish the current line in the onloadrecord event, but $this->SC_seq_page; is returning nothing. Iā€™m sure Iā€™ve seen this work in the past!

Edit
For my purpose it seems to be $sc_seq_vert which gives the row number.

I am not using that anymore, on MySQL I use the @rownum reserved word to add the row number to my SELECT

SELECT @rownum:=@rownum + 1 as row_num, 
       t.field1, t.field2, t.field3, ...
FROM ( 
   select field1, field2, field3, ... from myTable
) t,
(SELECT @rownum := 0) r;
2 Likes