morpheus
1st January 2003, 06:13
Hello,
First of all, happy new year to all!!.
While debugging my script, I typed time in the debug mode. This variable is neither declared in the script nor is a predefined variable, but to my surprise it showed it's value!! And the value was current system time in hhmm format.
Now, in the script I compared this variable, time, with the form field (time entered by user). This time, I declared variable time. But, this comparison is NOT working. The code always follows the route which says that -
input.time > time
no matter what the input value is!!?:confused:
Anybody got hints!?
shah_bs
2nd January 2003, 03:48
Hmm... I was not aware of 'time' being available as an internal global variable - I knew about 'date'. Thanks - I can add one more arrow to my quiver!
What probably happened when you declared your own time variable is that the global variable got 'hidden'. Now since the initialization of your own variable is to 0, it will work as you describe.
I am not sure, but if you remove your own declaration of time, things should work as you are expecting to. Alternatively, call your own declaration as p.time.c (or whatever other name that you desire except 'time' - this is a convention I use 'p' for 'program variable', 'c' for customization - helps keep the new variable very visible), assign 'time' to that and use the new variable. (This would definitely be required, if you plan to use the value in a select statement, because of the : construct ).
morpheus
2nd January 2003, 07:46
I know about date and time as internal global variables. Are there any more also, so that I can also add arrows in my quiver!!
Anyway, after I declared the "time" variable, I checked in the debug mode, the variable still had the system time. Also, I had to declare the variable, as the comparison was not possible otherwise. BaaN was throwing an error on that. I did declare a variable "tmp", transferred "time" into it, and used the IF statement, but the same result!!!
OmeLuuk
2nd January 2003, 10:02
Here (http://www.baanboard.com/programmers_manual_baanerp_help_misc_predefined_variables) is the list with predefined variables on session scripts, (there is also one on report scripts (http://www.baanboard.com/programmers_manual_baanerp_help_report_scripts_predefined_variables)). The BaanIV variable:
time R current system time; format HHMM
is not mentioned there, but from the format, I would not be supprised it being a variable of type string. Maybe you have a variable type mismatch.
morpheus
2nd January 2003, 11:07
I changed the type of "time" from long to string. The only difference was that this time system time was within quotes("")!! And the result was still the same -
input.time > time