Where do I put validations?

rcandeo

Well Known Member
I am doing an application that is a header/detail.
I have to make some validations in the grid of my detail screen, but I don´t know where is the right place to put this logic.
I´ve tried in some places but in all of them, if I hit OK two or three times, I don´t get the error in all the times, and the application continues where it should stop.
Can anyone help me with that?
Thank You.

Robson Candêo
Placas do Paraná - Brazil
Xe, SP16, AS400 with Central Objects on it, Windows 2000.
 
Hi Robson,

Would you please tell us a bit more about what kind of validation do you want to do are where are you already tried to place it in?

Further would you please explain, what does it mean "if I hit OK two or three times, I don´t get the error in all the times..."?

Thanks,

Read you later,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Hi Zoltán,
Sorry, this is a little hard to explain in my native language, imagine in a foreign one.
Lets try again:
I have a header file and a detail file.
In my header/detail screen, I have my header file associated in the first part and my detail file associated with the grid.
I have to make some validations in all the grids that are filled. (to see if the data is consistent).
I´ve putted this validation on Add Grid Rec to DB - Before.
When I do my test, i fill the screen and fill the grid with so many records as I need and click OK.
I receive the errors in the lines of the grid that have errors.
Then I clik OK again, and the processing continues.
If I didn´t change anything, I should continue receiving this errors.
It seems that when you get an error, the system doesn´t process the line again, unless you change anything on it.

Robson Candêo
Placas do Paraná - Brazil
Xe, SP16, AS400 with Central Objects on it, Windows 2000.
 
Hi Robson,

Thanks for your update.
Here are my suggestions:

1.) Place your validation logic into Button Clicked event of the OK button.
2.) First issue a ClearGridCellError (Grid category) with AllRows and AllCoulumns parameter.
3.) Pick up the number of rows in the grid using the GetMaxGridRows system function (Grid category).
4.) Loop through the rows of the grid in a While loop incremeting a row counter and comparing it MaxGridRows value and selecting the consequent rows using GetGridRow system function (Grid category).
5.) Perform your validation logic and set errors when it is necessary. You can also amanage an cErrorFound_EV01 flag.
6.) If your logic requires then perform the reamining validation after you have gone through all rows.
7.) Issue a StopProcessing system function call (General category) when you detected any error and do not want to perform the OK.

Hope could help a bit.

Please, keep us informed that does it work for your or not! Thanks!

Good luck!

Regards,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Robson,

Excuse me, I have forgotten to add:

You can examine an example for this method in the single form of P12130 Beginning Balance Adjustments, although it is a Headerless/Detail but it isn't really interesting here.

Regards,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Zoltán, you helped too much. But I´ve got a new problem.
For some reason, the function GetMaxGridRow is bringing the result added with one more line.
Do you know why?


Robson Candêo
Placas do Paraná - Brazil
Xe, SP16, AS400 with Central Objects on it, Windows 2000.
 
Hi Robson,

I suppose this one more line is the last entry row.
If this one more line appears always independently of the sequence of the user actions then never mind. Count down one or change your compare phrase from "less than or equal" to "less than".

Regards,

Zoltán

B7332 SP11, ESU 4116422, Intel NT4, SQL 7 SP1
(working with B7321, B7331, XE too)
 
Yeah, I was already doing that.
Thank You Very Much, you were great.
Bye

Robson Candêo
Placas do Paraná - Brazil
Xe, SP16, AS400 with Central Objects on it, Windows 2000.
 
Back
Top