This topic is locked

Scaling of decimal entries

8/30/2007 6:11:05 AM
PHPRunner General questions
X
xliner author

Hello,
I have a web appliance project where I want to restrict the user to enter whatsoever price but to enter prices within a certain range.
Now, citing ex PHPR help file, i.e. "Scale (applies to DECIMAL datatype in SQL Server, Oracle and MySQL only)" I can see the SCALE option, but how reads the exact field entry ???, e.g. if wanting the user to only be able to enter a decimal value between $200 and $215 ???
The help file does not provide any example code, hence these lines.
Thx 4 short reply. Best - Hajo

M
morpheus 8/30/2007

Hi Hajo,
what backend database are you using?
personally i'd create a table called parameters, with the upper and lower limits you require (so that this can easily be changed) and then use the before edit or before add functions to check this value against the values in your "parameters" table, if this is within the parameters then allow the record to be added or amended, if it fails then dissallow the edit/addition and popup a messagebox telling the user why the record update/addition was refused. this way should you need to you can also enter different parameters for different users/groups without having to re-code everything.
sort of like (and i know this isnt the correct syntax)
enter value X

if value x is between parameter.low and parameter.high

commit record

else

messagebox"please enter a value for X between parameter.low and parameter.high"

dissalow record
Just a thought but it may be what you need, anyone with any other ideas please feel free to jump in <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=21004&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />
regards
Jason

Hello,

I have a web appliance project where I want to restrict the user to enter whatsoever price but to enter prices within a certain range.
Now, citing ex PHPR help file, i.e. "Scale (applies to DECIMAL datatype in SQL Server, Oracle and MySQL only)" I can see the SCALE option, but how reads the exact field entry ???, e.g. if wanting the user to only be able to enter a decimal value between $200 and $215 ???
The help file does not provide any example code, hence these lines.
Thx 4 short reply. Best - Hajo

X
xliner author 8/30/2007

Jason,
thx 4 the "VISTA" like proposal to finally settle on the current SCALING issue, in order to reply to your question, I am on MySQL.
In fact, ownership of the correct code to get my 5 to 10 products under "pre-defined price range" entry restriction would be worth to be thrown into the "Tips and Tricks" forum section later on as I fully agree, the ability to change LOW and HIGH entries without re-coding is more than tasting fine.
I´m sure, we shall read something here by Sergey, Alexey or Jane any time from now ...
Best - Hajo
P.S. Above even bundled to USER GROUPS or USER DEFINED "HIGH and LOW" could become a serious threat to EBAY, once one wants to drill things down to the "monetary reserves" web section in full ;-)