Hi Steve,
at first I would strongly recommend to change the field "code" in something like "cCode" to avoid trouble with the reserved word "
CODE". The same to "Increment" in rate and "DEST". Avoid anything in Variable/Table/Fields/Property/etc. names that is colored like a keyword. I personally like Hungarion Notation on anything but this is a matter of taste.
So lets see if I understand.
cdr is the list of the calls done
rate is a list with rates and the numbers the rates belongs to
i.e.
rate has a number (dnis) '0351' and cdr has a number (code) '0351712561'
now you try to connect both using relation.
IOW you compare '0351712561' with '0351' this will fail. AFAIK the comparision on SET Relation is not influenced by SET EXACT it's like
==.
you may easaly test if you do
SET EXACT off
?"Rating file"
SELECT cdr
INDEX ON dnis TAG dnis
SELECT rate
index on code tag code desc
SET RELATION TO ALLTRIM(code) INTO cdr
SET SKIP TO cdr
select cdr
browse last nowait
SELECT rate
browse last nowait
For the first you will not see lines with **** in rate (that will be the 'skipped' ones)
For the second you will see the related lines in cdr. There should be a line for each rate?
You see how it fail?
I would suggest something like first getting the information with a select (this is bound to SET EXACT) and then REPLACE like
SELECT cdr
SET ORDER TO _Primary
INDEX ON UniqueID TAG _UNI
SET EXACT OFF
SELECT;
Cur2.UniqueID AS CDR_Uni,;
Cur1.DEST AS CDR_Dest,;
Cur1.CODE AS CDR_Code,;
Cur1.Rate AS CDR_Rate,;
Cur2.Duration AS CDR_Duration,;
IIF(Cur2.Duration >0,;
IIF(Cur2.Duration<Cur1.MinimumSec,;
(Cur1.MinimumSec/60),
(CEILING(Cur2.Duration/Cur1.INCREMENT)/60*Cur1.INCREMENT)),;
0) AS CDR_billdur,;
IIF(Cur2.Duration > 0,Cur1.Rate*Cur2.billdur,0) AS CDR_Charge;
FROM Rate AS Cur1,;
INNER JOIN cdr AS Cur2;
ON ALLTRIM(Cur2.dnis)=Cur1.CODE;
AND !EMPTY(Cur2.DEST);
INTO CURSOR curHelp
SET RELATION TO CDR_Uni INTO CDR
REPLACE;
CDR.Rate WITH CDR_Rate,;
CDR.DEST WITH CDR_Dest,;
CDR.CODE WITH CDR_Code,;
CDR.BillDur WITH CDR_BillDur,;
CDR.Charge WITH CDR_Charge;
ALL
SET RELATION TO
USE
SELECT cdr
SET ORDER TO
HTH
Agnes
>Not sure why it wouldn't let me send this earlier, not throwing an error now
>SET EXACT off
>
>?"Rating file"
>SELECT cdr && cdr is call records in previous
> INDEX ON dnis TAG dnis &&DNIS is dialedNo
>
>SELECT rate
> index on code tag code desc &&code is dialCode
>
>SET RELATION TO ALLTRIM(code) INTO cdr
> SET SKIP TO cdr
> replace cdr.rate with rate;
> , cdr.dest WITH dest;
> , cdr.code WITH code;
> , cdr.billdur WITH IIF(cdr.duration >0,IIF(cdr.duration < rate.minimumsec,(rate.minimumsec/60),(CEiLING(cdr.duration/rate.increment)
> /60*rate.increment)),0);
> , cdr.charge with IIF(cdr.duration > 0,rate*cdr.billdur,0)
> FOR empty(cdr.dest)
>
>disregard the improper line changes within the code, it's just wrapping around
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]