1 is greater then 2 ?!?

I'm trying to schedule some events based on dates, and not really having much luck. My problem comes from a <gt> comparison. Earlier today I was getting that 0 was not greater then -29, now I'm getting that 1 is greater then 2! Can anyone shed some light on what is happening?

Here is the trace of my questionable code....

<cond>

<gt>

<ref>daysAllowedForAccess</ref> --> 1

<ref>daysUntilAffiliation</ref> --> 2

</gt> --> 1

[524 byte] By [JimBearda] at [2007-11-26 14:52:57]
# 1

Hi,

I created a simple rule to test this:

<Rule name='New Rule'>

<cond>

<gt>

<ref>daysAllowedForAccess</ref>

<ref>daysUntilAffiliation</ref>

</gt>

<s>daysAllowedForAccess</s>

<s>daysUntilAffiliation</s>

</cond>

</Rule>

Following is the trace and the results are coming just fine as expected:

<Rule name='New Rule'>

<cond>

<gt>

<ref>daysAllowedForAccess</ref> --> 1

<ref>daysUntilAffiliation</ref> --> 2

</gt> --> 0

<s>daysUntilAffiliation</s> --> daysUntilAffiliation

</cond> --> daysUntilAffiliation

</Rule> --> daysUntilAffiliation

<Rule name='New Rule'>

<cond>

<gt>

<ref>daysAllowedForAccess</ref> --> 0

<ref>daysUntilAffiliation</ref> --> -29

</gt> --> 1

<s>daysAllowedForAccess</s> --> daysAllowedForAccess

</cond> --> daysAllowedForAccess

</Rule> --> daysAllowedForAccess

Regards,

Hemant

HemantPooniaa at 2007-7-8 8:41:13 > top of Java-index,Web & Directory Servers,Directory Servers...
# 2

May it is related to values having spaces?

Check out the following:

<block trace="true">

<gt>

<s> 1</s>

<s>2</s>

</gt>

<gt>

<s>1</s>

<s> 2</s>

</gt>

<gt>

<s>1</s>

<s>2</s>

</gt>

<gt>

<s>1</s>

<i>2</i>

</gt>

<gt>

<i>1</i>

<i>2</i>

</gt>

<gt>

<i>1</i>

<s>2</s>

</gt>

</block>

This results in

<block trace='true'>

<gt>

<s> 1</s> --> 1

<s>2</s> --> 2

</gt> --> 0

<gt>

<s>1</s> --> 1

<s> 2</s> --> 2

</gt> --> 1

<gt>

<s>1</s> --> 1

<s>2</s> --> 2

</gt> --> 0

<gt>

<s>1</s> --> 1

<i>2</i> --> 2

</gt> --> 0

<gt>

<i>1</i> --> 1

<i>2</i> --> 2

</gt> --> 0

<gt>

<i>1</i> --> 1

<s>2</s> --> 2

</gt> --> 0

</block> --> 0

Iddoa at 2007-7-8 8:41:13 > top of Java-index,Web & Directory Servers,Directory Servers...
# 3

I believe it has to do with variable types. xpress is loosly typed and does not enforce any strict data types. Through trial and error, I figured out that I was comparing an xpress int (<i>30</i>, or whatnot) with a primitive java long variable type that was being returned through an invoke method. I subsequently changed my code to reflect,

<gt>

<mult>

<ref>daysAllowedForAccess</ref>

<i>1</i>

</mult>

<invoke name='parseInt' class='java.lang.Integer'>

<invoke name='toString' class='java.lang.Long'>

<ref>daysUntilAffiliation</ref>

</invoke>

</invoke>

</gt>

and now its working fine. I bit of a work around it seems....

JimBearda at 2007-7-8 8:41:13 > top of Java-index,Web & Directory Servers,Directory Servers...