This topic is locked
[SOLVED]

 take a previous record value while adding a new record

2/9/2018 11:36:00 AM
PHPRunner General questions
C
casuva author

Hi

I want to record the kilometers of the vehicle in the program I'm trying to do.

When adding a new record, I want to take advantage of the previous record value and avoid the incorrect entries. As you can see in the link, when adding a new record, the new record must be larger than the last record of the previous record from the first record.

I have no idea how to do this.

I'll be happy if you can help me.
Thanks <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=25331&image=1&table=forumtopics' class='bbc_emoticon' alt=':rolleyes:' />
Table

C
casuva author 2/9/2018



Check this:

https://xlinesoft.com/phprunner/docs/speed_up_data_entry_using_events.htm



thanks sergey but did not anything about my request..
i hope to see;

last_record.$value["close_km"] >= previous_record.$value["open_km"];
admin 2/9/2018

This article shows you how to save entered values in session variables and use them as default values when adding the next record.
Try this.

  1. AfterAdd event

$_SESSION["open_km"] = $values["open_km"];


2. BeforeAdd event

if ($_SESSION["open_km"] && $_SESSION["open_km"]>$values["close_km"]) {

$message = "close_km should be greater than ".$_SESSION["open_km"];

return false;

}


PS. your image cannot be open, you didn't share it.

C
casuva author 2/9/2018

Thanks Sergey and so sory. I forget share the file.
Table is here.
Again thanks..

admin 2/9/2018

I already provided the answer.