CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Record shifting problem

Print topic Send  topic

Author Message
szenczi

Posts: 67
Posted: 04/01/2008, 1:54 AM

Hi,

I' ve got a problem with an editable grid. I use only one table in this object and in the BeforeBuildUpdate event I calculate some of the fields.
When I inserted rows, the first one was ok, but from the second all rows are shifted by 1. (Last crated row gets the first row's value.) The second (and later always the last) row get the correct value after only the second submit (but in the wrong place). After the first submit, the last two rows get the first record's value. Then after the second submit: last row = 1st row's value, last-1 row =last row's value.
In this object I don't use any function which overwrite the recordset. (Only CCSetSession(), GetValue() and operators.)

I hope my description was understandable.
Thank you, Norbert
_________________
CCS5.1, PhP, MySQL
View profile  Send private message
wkempees


Posts: 1679
Posted: 04/01/2008, 2:31 AM

Can you post the code in BeforeBuildUpdate here?
Seems like a 'row count' or 'row index' problem.
No direct solution, just effort offered.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
szenczi

Posts: 67
Posted: 04/01/2008, 2:41 AM

//tandij_ds_BeforeBuildUpdate @60-D1F14785
function tandij_ds_BeforeBuildUpdate(& $sender)
{
$tandij_ds_BeforeBuildUpdate = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $tandij; //Compatibility
//End tandij_ds_BeforeBuildUpdate

//Custom Code @182-2A29BDB7
// -------------------------

$oradij = CCGetSession("oradij");
$havioraszam = $tandij->havioraszam->GetValue();
$havidij = $havioraszam * $oradij;
$pluszorakod = $tandij->pluszoraar->GetValue();
$pluszoraar = $tandij->pluszoraar->GetValue();
$pluszoradb = $tandij->pluszora->GetValue();
$pluszoradij = $pluszoradb * $pluszoraar;
$kulonbozet = $tandij->kulonbozet->GetValue();
$fizetendo = $havidij + $pluszoradij + $kulonbozet;
$tandijkod = $tandij->tandijkod->GetValue();
CCSetSession("havidij",$havidij);
CCSetSession("fizetendo",$fizetendo);

// -------------------------
//End Custom Code

//Close tandij_ds_BeforeBuildUpdate @60-44D492A7
return $tandij_ds_BeforeBuildUpdate;
}
//End Close tandij_ds_BeforeBuildUpdate

_________________
CCS5.1, PhP, MySQL
View profile  Send private message
DonB
Posted: 04/01/2008, 3:40 AM

Perhaps it is something in another part of your page. Remember: The form
numbers the grid rows as 1,2,3,4... The data source numbers them as
0,1,2,3...

--
DonB



"szenczi" <szenczi@forum.codecharge> wrote in message
news:247f203350cc51@news.codecharge.com...
> //tandij_ds_BeforeBuildUpdate @60-D1F14785
> function tandij_ds_BeforeBuildUpdate(& $sender)
> {
> $tandij_ds_BeforeBuildUpdate = true;
> $Component = & $sender;
> $Container = & CCGetParentContainer($sender);
> global $tandij; //Compatibility
> //End tandij_ds_BeforeBuildUpdate
>
> //Custom Code @182-2A29BDB7
> // -------------------------
>
> $oradij = CCGetSession("oradij");
> $havioraszam = $tandij->havioraszam->GetValue();
> $havidij = $havioraszam * $oradij;
> $pluszorakod = $tandij->pluszoraar->GetValue();
> $pluszoraar = $tandij->pluszoraar->GetValue();
> $pluszoradb = $tandij->pluszora->GetValue();
> $pluszoradij = $pluszoradb * $pluszoraar;
> $kulonbozet = $tandij->kulonbozet->GetValue();
> $fizetendo = $havidij + $pluszoradij + $kulonbozet;
> $tandijkod = $tandij->tandijkod->GetValue();
> CCSetSession("havidij",$havidij);
> CCSetSession("fizetendo",$fizetendo);
>
> // -------------------------
> //End Custom Code
>
> //Close tandij_ds_BeforeBuildUpdate @60-44D492A7
> return $tandij_ds_BeforeBuildUpdate;
> }
> //End Close tandij_ds_BeforeBuildUpdate
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

wkempees


Posts: 1679
Posted: 04/01/2008, 4:14 AM

Hard to understand, what language is that... out of interest?
Not quite clear what you are trying to do.
Except that, from your code I see you are getting data from the grid's fields without
indicating which row you are trying to read.

http://forums.codecharge.com/posts.php?post_id=60507
Is a good article on how to handle the rows of an editable grid.
In a nutshell, you are always reading the same formdata, i.e. the formdata from the first changed (submitted) row.

HTH,

Walter

_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
wkempees


Posts: 1679
Posted: 04/01/2008, 4:42 AM

Try this, to get the idea:
  
//tandij_ds_BeforeBuildUpdate @60-D1F14785  
function tandij_ds_BeforeBuildUpdate(& $sender)  
{  
$tandij_ds_BeforeBuildUpdate = true;  
$Component = & $sender;  
$Container = & CCGetParentContainer($sender);  
global $tandij; //Compatibility  
//End tandij_ds_BeforeBuildUpdate  
  
//Custom Code @182-2A29BDB7  
// -------------------------  
echo 'RowNumber=' . $Container->RowNumber; // displays the Row being processed.  
echo 'Havioraszam : ' . CCGetParam("havioraszam_" . $Container->RowNumber,"") .'<br>';   
  
$oradij = CCGetSession("oradij");  
$havioraszam = $tandij->havioraszam->GetValue();  
$havidij = $havioraszam * $oradij;  
$pluszorakod = $tandij->pluszoraar->GetValue();  
$pluszoraar = $tandij->pluszoraar->GetValue();  
$pluszoradb = $tandij->pluszora->GetValue();  
$pluszoradij = $pluszoradb * $pluszoraar;  
$kulonbozet = $tandij->kulonbozet->GetValue();  
$fizetendo = $havidij + $pluszoradij + $kulonbozet;  
$tandijkod = $tandij->tandijkod->GetValue();  
CCSetSession("havidij",$havidij);  
CCSetSession("fizetendo",$fizetendo);  
  
// -------------------------  
//End Custom Code  
  
//Close tandij_ds_BeforeBuildUpdate @60-44D492A7  
return $tandij_ds_BeforeBuildUpdate;  
}  
//End Close tandij_ds_BeforeBuildUpdate  

This should make things clear I hope.

Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)

if you liked this info PAYPAL me: http://donate.consultair.eu
View profile  Send private message
szenczi

Posts: 67
Posted: 04/01/2008, 7:28 AM

The language is hungarian...

My task is to calculate the values (havidij and fizetendo) before submitting the form. As I seen, if I did it in the BeforeBuildUpdate event, it is executing row-by-row BUT the order isn't correct. (I tried with your prpoposed way in the other topic->the effect was multiple with the row count.)

In other events, such as BeforeSubmit, it's a must to refer to the each rows programatically of course. I tried it too but I can't get any valid data with this referring (field_name_x), all rows were empty.

Thanks,
Norbert
_________________
CCS5.1, PhP, MySQL
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.