NetTalk Central

Author Topic: About formatting string/long  (Read 4218 times)

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
About formatting string/long
« on: August 24, 2011, 01:51:04 AM »
I have string datafield which is formatted in @n06 picture.
In offline application, formating this field goes without problem (format(dat:numb,@n06)), but from web application, how to format to get exactly the same?
When I close/complete form in which that field is, I got wrong formatted field in database. In session value also all look well, but on completion and after inserting in database, no.
For example: the right format must be 000056, but I have in database entry of 56...
Regards, Ozren

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: About formatting string/long
« Reply #1 on: August 24, 2011, 05:51:03 AM »
Ozren,

I haven't done this, but I'm sure it will work.

Make the field a string field, not a number field. then format the number in the way as you have it with FORMAT - then the value should display with the zeros padded in front. The only thing then is that the default number validation won't work because it is now regarded as a string. You could then do the validation yourself.

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: About formatting string/long
« Reply #2 on: August 24, 2011, 08:00:57 PM »
what is the data type of dat:numb ?

cheers
Bruce

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: About formatting string/long
« Reply #3 on: August 24, 2011, 10:42:52 PM »
Dat:numb is string, formatted in @n06 picture....
Dont ask why  :)
And I cannot change it in dictionary...
I forgot to say that dat:numb is last part of 5-component primary, unique, autoincrement key

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: About formatting string/long
« Reply #4 on: August 25, 2011, 09:33:11 PM »
In that case, format the field directly in the ValidateValue::Fieldname routine
ie

dat:numb = (format(dat:numb,@n06)

I hope for your client's sake the number doesn't go past 100000 records.

Cheers
Bruce

oggy

  • Full Member
  • ***
  • Posts: 219
    • View Profile
    • Email
Re: About formatting string/long
« Reply #5 on: August 25, 2011, 10:57:35 PM »
Never, ever in past four years, any of our customers did not pass this magically boundary of 100000 records, not even close.. This will mean 100000 invoices per year, ;)
Regards, Ozren.