red1.org Forum Index red1.org
Nihili est - in vita priore ego imperator romanus fui
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MField Does Not Compare in Display Logic

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    red1.org Forum Index -> BUGS Galore!
View previous topic :: View next topic  
Author Message
red1
Site Admin


Joined: 06 Jul 2004
Posts: 1756
Location: Kuala Lumpur, Malaysia

PostPosted: Thu Aug 05, 2004 6:19 pm    Post subject: MField Does Not Compare in Display Logic Reply with quote

This is discovered when in WindowTabField, in the Field Tab, at the Display Logic control, you can only do "equals to" and "not equals to", missing on the "greater than" and "less than" stmts.

I contributed this in version 250 but now in 251e it still isnt there. So here it is again. Go to MField.java in your Eclipse, and put in these two snippets.
You can also pick up the whole code here http://compiere.red1.org/MField.zip. Its is version 251e, fully commented with usage example. Razz

private boolean evaluateLogicTuple (String logic)
{
//red1 -- init Float variables to handle string Evals in < > comparisons
float f1 = 0; //red1
float f2 = 0; //red1
StringTokenizer st = new StringTokenizer(logic.trim(), "<>!=^", true); //red1 <> added here

=====================2nd snippet a bit lower ===========

// Logical Comparison
boolean result = firstEval.equals(secondEval);
if (!compare.equals("="))
result = !result;
//
// red1 -
if (compare.equals(">"))
{ result = false;
f1 = Float.parseFloat(firstEval);
f2 = Float.parseFloat(secondEval);
if (f1>f2)result = true;
}
//red1 --
//red1 - if compare '<'
if (compare.equals("<"))
{ result = false;
f1 = Float.parseFloat(firstEval);
f2 = Float.parseFloat(secondEval);
if (f1<f2)result = true;
}
//Set in WindowTabColumn, Field Tab, DisplayLogic example:"@thisField@>99 | @thisField@=99"
//red1 -- thisField is firstEval, 99 is secondEval -- end
if (Log.isTraceLevel(10))
Log.trace(10, "MField.evaluateLogicTuple - " + logic + "=> \"" + firstEval + "\" " + compare + " \"" + secondEval + "\" => " + result);
//
return result;
} // evaluateLogicTouple
Back to top
View user's profile Send private message Send e-mail Visit poster's website
red1
Site Admin


Joined: 06 Jul 2004
Posts: 1756
Location: Kuala Lumpur, Malaysia

PostPosted: Wed Aug 18, 2004 10:01 am    Post subject: Finally Fixed by Jorg... interesting to see how they do it Reply with quote

Here's a message reply from Compiere, that this bug is fixed. So what u ppl can do is to reload the latest MField.java from sourceforge and see how it is properly done. Should be fun to compare between a true pro and me as a dummy Embarassed All in good jest!

Category: Application Dictionary
Group: R2.5.1+
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: d. oon poh shin (red1)
>Assigned to: Jorg Janke (jjanke)
Summary: WindowTabField doesnt handle >, < display logic - fixed!

Initial Comment:
I fixed a bug in MField.java so that it can handle display
logic comparisons 'greater than' and 'less than'.

When u go into WindowTabColumn, Field tab, Display
Logic column, u can only specify '!', '=' when the Help
notes said u could also do >,<.

Now it can. Using Floats to evaluate.
Done on version251e.

Fully commented //red1.

best regards
red1

----------------------------------------------------------------------

>Comment By: Jorg Janke (jjanke)
Date: 2004-08-17 01:06

Message:
Logged In: YES
user_id=87038

** Fixed in next release (R2.5.1e) **

----------------------------------------------------------------------

Comment By: Jorg Janke (jjanke)
Date: 2004-08-17 01:06

Message:
Logged In: YES
user_id=87038

Sorry, it needs to handle
AA>BB .. strings
1>2 .. numbers
1>AA .. strings
0>0.0
@variable@>@variable@
--
fixed.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    red1.org Forum Index -> BUGS Galore! All times are GMT + 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group