Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

FormatString Function

edited January 2003 in RAP
Hello,

I am trying to use the formatstring function on a variable to take a value,
right align it, and pad any spaces with zero. I am able to get the right
align with the ! in the mask but I can't get the pad of zeros. So for
example my number value comes in at 55 and I want 0055.

EntryString := EntryString +
FormatString('!0000;0;0',Copy(plBatch['BatchNo'],0,4));

Thanks,

Ian

Comments

  • edited January 2003
    Hi Bruce,

    create a pass-through function or use something simpler than 'FormatString' e.g.:

    var
    s : String
    begin
    s := Trim(Copy(plBatch['BatchNo'],1,4)));
    Value := Copy('0000', 1, 4 - Length(s)) + s;

    Note: 'Trim' is currently not implemented (, AFAIK) -> create your own pass-through 'Trim' function.

    BTW, your start parameter in the following expression is wrong!
    Copy(plBatch['BatchNo'], _0_ ,4))
    it must at less '1'!

    regards,
    Chris Ueberall;
This discussion has been closed.