This topic is locked
[SOLVED]

  Automumber report within groups

8/11/2013 4:19:39 PM
PHPRunner General questions
L
lijn76 author

I use phprunner 6.2
I have a report based on the table "verlof_aanvragen with the fields:

Datum (date)

persnummer (nummeric)

reden (lookup)

akkoord (yes/no)

[size="2"]aangevraagd (datetime)[/size]

[size="2"]Grouped by DATUM[/size]
[size="2"]I also made a field by putting in:[/size]

[size="2"]QUERY DESIGN:[/size]

[size="2"]added field 0 as rang[/size]
[size="2"]Then I putted in:

Report page: Before SQL Query: [/size]$_SESSION["Rang"]=0
and

Report page: Javascript onload event: $_SESSION["Rang"]=0;
and

in Visual design as setting of the field"rang" View as CUSTOM
$_SESSION["Rang"] += 1;

$value = $_SESSION["Rang"];
so far so good

Now I have ranked te report starting with 1

When opened it is always the same ( no longer keeps going on all the time)


What I really want now, is that the ranking starts at 1 every group

donderdag 17 oktober 2013 should be 1. 2. 3. 4 and so on.
Can anyone help me with this?

Hans

L
lijn76 author 8/12/2013

sorry, same result !

does not rank within groups

Hans

C
cgphp 8/12/2013

Sorry, I had misunderstood your request. Remove any code you entered before in the "Javascript" and "Before SQL" events and from the "View as custom". Now follow these steps:

  1. In the "Before process" event, enter the following code:

$_SESSION['last_date'] = '';

$_SESSION['Rang'] = 1;


2. In the "View as custom" of the Rang field, enter the following code:

if($_SESSION['last_date'] != $data['Datum'])

{

$_SESSION['Rang'] = 1;

$_SESSION['last_date'] = $data['Datum'];

}

else

{

$_SESSION['Rang']++;

}
$value = $_SESSION['Rang'];
L
lijn76 author 8/13/2013



Sorry, I had misunderstood your request. Remove any code you entered before in the "Javascript" and "Before SQL" events and from the "View as custom". Now follow these steps:

  1. In the "Before process" event, enter the following code:

$_SESSION['last_date'] = '';

$_SESSION['Rang'] = 1;


2. In the "View as custom" of the Rang field, enter the following code:

if($_SESSION['last_date'] != $data['Datum'])

{

$_SESSION['Rang'] = 1;

$_SESSION['last_date'] = $data['Datum'];

}

else

{

$_SESSION['Rang']++;

}
$value = $_SESSION['Rang'];



Thank you so much Cristian, this is exactly what I wanted


This works as we say in Holland like a "tierelier" very good !

You made me happy!
Hans
p.s I now really made the Rang field in the database.

Otherwise it give problems with exporting to excel, with error "non existing field". This is fixed to.
This is the result