Align numbers in Confirm dialog

CalicoCalico Member Posts: 31
I am trying to produce a message of three lines each with two numbers in them and to make it tidier and more readable I would like to align the numbers in two columns like so

Line 1 some text ....123456.78....543210.43
Line 2 longer text........... 3.00..6453981.22
Line 3 text.................123.45.........78.99

but what I get looks like this no matter what I try

Line 1 some text 123456.78 543210.43
Line 2 longer text 3.00 6453981.22
Line 3 text 123.45 78.99

Which looks a mess specially as the numbers can range from 0 to over 1,000,000 - and in fact when I test this post in preview I have just the same problem unless I replace the spaces with dots.

Has anyone got any ideas? I've tried %1, #1######, formatting the numbers as strings but they still won't align properly

Comments

  • garakgarak Member Posts: 3,263
    could you please post your source here to understood what you mean.
    Do you make it right, it works too!
  • CalicoCalico Member Posts: 31
    I don't think it will help much to post the code - since it doesn't work (and also I have tried several different options) but here goes -


    IF DIALOG.CONFIRM(Text001+Text002+Text003+Text004+Text005,FALSE,"Housing Allowance",gHseAmt,"Trans. Allowance",
    gTrnAmt,"Other Allowances",gOthAmt,"No.") THEN UpdateAllowance;

    The text constants are as follows:

    Name ConstValue
    Text001 %7 Current Calculated\
    Text002 Housing : %1 %2\
    Text003 Transport: %3 %4\
    Text004 Other : %5 %6\\
    Text005 Do you want to update record?

    and the values are all decimals and despite the way it posts, the substitution markers are all lined up in columns in the text constants.

    I should point
  • SavatageSavatage Member Posts: 7,142
    well the numbers don't "need" to remain numbers in an info box.
    :-k
    My thought would use FORMAT to convert to text.
    Use STRLEN to get the length of the string.

    subtract that from the largest possible # of characters you expect to have.
    then you have a number of "dots" that you need.

    not sure if it works with dialog boxes - but you can try.......
    have a look at this post:
    viewtopic.php?f=23&t=36219
  • JedrzejTJedrzejT Member Posts: 267
    You can do this in other way - by save all this paraameters in temporary table (text,number1,number2) and run form with question instead of confirm. Maybe even without the table just by pass parameters to form.
    Its easier to develop good looking form i think
  • David_SingletonDavid_Singleton Member Posts: 5,479
    JedrzejT wrote:
    You can do this in other way - by save all this paraameters in temporary table (text,number1,number2) and run form with question instead of confirm. Maybe even without the table just by pass parameters to form.
    Its easier to develop good looking form i think

    :thumbsup:

    This is also how I would do it. Its really hard to get messages looking exactly as you need them, and Forms are cheaper than the customer paying you to write code and experiment.
    David Singleton
  • CalicoCalico Member Posts: 31
    Thanks for the help. I think the form option is probably the only solution. Because NAV does not distinguish between fixed length text fields and variable length strings, there is no way that the figures can be aligned in a dialog box - or at least not without an inordinate amount of coding.

    Have a good weekend.
Sign In or Register to comment.