HomeForum
Welcome, Guest

transformer - write to specific field on condition
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: transformer - write to specific field on condition

transformer - write to specific field on condition 1 year, 4 months ago #1335

  • Frank
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Is it possible to use transformer to write to a specific field based on the condition of the value.

For example, in my reader I can have negative or positive values in a specific field. If the value is negative, I would like to write it to a Credit Field, and, if it is positive I would like to write it to a debit field.

example:

reader field [Amount]
Write Field [ Debit] or [Credit]

Amount = 100 -> Debit
Amount = -100 - > Credit

Re: transformer - write to specific field on condition 1 year, 4 months ago #1336

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2174
  • Karma: 12
Sure

add two calculation functions into the transfromer object

and use following scripts

begin
if (StrToFloat([F001])>0) then
result:=[F001]
else
result:='';
end;

begin
if (StrToFloat([F001])<0) then
result:=[F001]
else
result:='';
end;

Mike

Re: transformer - write to specific field on condition 1 year, 4 months ago #1337

  • Frank
  • OFFLINE
  • Junior Boarder
  • Posts: 29
  • Karma: 0
Can you show me how that would be laid out? Would the 2 calculations be set in series, or parallel. Sorry, I am a little confused on how to structure this.

Re: transformer - write to specific field on condition 1 year, 4 months ago #1338

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2174
  • Karma: 12
Assuming that your field is called amount

connect amount to two calculations in parallel
than connect first calculation to debit field and second to credit

=> Calculation 1 => debit
amount =>
=> Calculation 2 => credit

Mike
  • Page:
  • 1
Time to create page: 0.17 seconds

Testimonials

Support team is quick and very often they reply to forum posts within minutes.

Mark Jonson,
EDS

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top