Page 1 of 1

lookup based on rules

Posted: Mon Dec 27, 2004 8:18 am
by jasper
For an aggregation of (telephony)call-data I need to find the type of call.
This is based on the first digits of the number being called(usually called the significant digits). Problem however is that the number of digits that matters is not always equal. sometimes first 2 is enough, but it can go up till the 8 first that can make a difference.
The way it is done now is to create all necessary substrings (2char,3char,...8char) and then do the 7 lookups. After these are done logic is applied to find the correct one(if 8char<>NULL, use this, else if 7char<>NULL,....) Since this is done for daily millions of records this takes too much time.

Any ideas on other ways of working?

Posted: Mon Dec 27, 2004 7:46 pm
by T42
Input -> Transformer (make multiple fields - phone[1,2] -> twodigitphone; phone[1,3] -> threedigitphone; et cetera) -> Lookups.

With the lookups, use reject links to push non-matches to other lookups. Start with small digits first (as there's less matching obviously), unless your business rules require the opposite.

Do you only need to make one match to confirm this?

Posted: Mon Dec 27, 2004 11:13 pm
by ray.wurlod
I once created a bitmapped approach - if the bit in the ordinal position represented by the numeric value of the code exists then it was a valid area code. Very quick. Did it in a server job, but it should be quite possible in PX.

Posted: Tue Dec 28, 2004 3:16 am
by jasper
T42,
thanx for the suggestion, this is however something I've allready tried. Since business rules require the opposite approach (first 8, then 7,...) This actually takes longer then doing all lookups in one lookup-stage and apply the logic later.


Ray,
I'll try your suggestion, thanx.