on 10-25-2013 1:07 PM
Hi experts,
I want the validation for date field in Agentry. i.e, the validation should not allow the user to enter past date.
For this I wrote a rule in transaction level and I mapped it as a validation rule as well.
Here the problem is the rule is allowing both future and past dates. But the validation message is populating.
My rule:
--can i add anything for this. Please suggest.
Thanks in advance,
Swaroopa.
Swaroopa,
Your screen shot of the rule doesn't make sense to me. I understand you want to restrict a data entered on a transaction screen to be earlier than (less than) another date. Are both of these dates entered on screen? The top date in your rule is probably the problem. That syntax appears wrong to me. Not sure what "Current Property" will do in this context. Make it simpler. If you have two dates in this transaction: Date1 and Date2, and you want to insure that Date1 is less than or equal to Date2, write your rule this way:
LTEQ
Date1 Property
Date2 Property
Don't get fancy with the targeting like you were attempting. The rule above will pass validation if Date1 is <= Date2. Like Shahid mentioned, Agentry Dates are just integers internally, so you can use standard math operators to compare them in rules.
Jason Latko - Senior Product Developer at SAP
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jason,
The rule I attached above is wrong. Initially I didn't observed that the agentry considers the date as integer internally. After that with the suggestion of shahid I debugged my above rule then I come to know it is considering the date as integer. There I place two properties those two are transaction properties only and both are returning the same integer values so it not doing any comparison.
After that I changed my rule as:
GTEQ
Property:"xxx"Transaction>"Date" Property>Current Property
Rule Function:Date.
--Current Property(1st parameter) defines the date property which is set by the transaction i.e, the user entered date
--Date rule function, it returns the current date.
So for current date it is returning one integer value. for the transaction date it is returning another integer value.
So we can compare those two values.
This approach is working fine. Is it is correct or can I do it in any other way.
Thanks,
Swaroopa.
Swaroopa,
The only issue I have is with your overly complex syntax when referencing the transaction property. You don't need to go to that extreme. In validation rules, it is sufficient to just list the property without any frills or extras. You do not need to reference the transaction name or current property of the property you have chosen. Agentry assumes these things in the context of a transaction validation rule. You only need to use the "Property" context menu to directly select the property you want to use, nothing more. Notice in the image below, the Filename transaction property is being used, and is easily picked directly from the list. In this case, less is more and the correct way to go about writing clean and easy to follow validation rules:
Jason Latko - Senior Product Developer at SAP
Have you tried debugging this rule using the Agentry Test Environment? What do you see?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Agentry maintains the DATE data type internally as an integer. When called in an integral or decimal number context, the DATE function will return the number of days before (negative number) or after (positive number) the date January 1, 2001. If your transaction property is of date type , it should also be showing as a number in the debug log.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.