Link to home
Start Free TrialLog in
Avatar of Amrit Samtani
Amrit Samtani

asked on

FastReport / Report Query Help - How do i convert a integer value into a string ?

I am using FastReport to create my reports right now, and i have an issue.
 
I have an one data attribute named "ProductMaster.ITEMBUYINGPRICE".

The output of this data is a 6 digit value showing the cost price. Let us say, for example its 205,450 .

However since this report needs to be printed . I need to encrypt the costs into an alphabetical value so only certain staffs who know the encryption would be able to know the cost . Therefore i need the report to automatically convert the data stored in ITEMBUYINGPRICE into a string value

My formula is as follows :
V = 1
G = 2
O = 3
B = 4
I = 5
N = 6
D = 7
R = 8
A = 9
M = 0

Therefore the cost above would read as "GMIBIM"

Could you guide me as to how/what function i should use  to code this into the report?

Thanks
Avatar of Mike McCracken
Mike McCracken

I looked through the user's manual on Fast Reports.  I don't see a way to do what you want.

There was mention of a scripting tool, Fast Scripts, that might be able to do what you want.

mlmcc
what is the dbms type & version you are using?
what's the database you're using? perhaps you can have a custom function to do the conversion of field: ProductMaster.ITEMBUYINGPRICE before passing the query to fast report? does it make sense to you?
SOLUTION
Avatar of Sinisa Vuk
Sinisa Vuk
Flag of Croatia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
delphi code is similar

a little bit compacter with a for than sinisa's code
function PriceCrypto(price: string): string;
const ch = 'MVGOBINDRA';
var I: Integer;
begin
  Result := Price;
  for I := 0 to 9 do
    Result := StringReplace(Result, IntToStr(I), Copy(ch, I+1, 1), [rfReplaceAll]);
end;

Open in new window