by James Bott » Wed Jul 26, 2017 3:23 pm
Mauri,
The xbrowse appears to be working correctly.
You could use ALIGN RIGHT, which is what one usually uses with numbers. That is what I would do.
Or, you could use something like strtran([fieldname]," ", chr(160)). This will replace spaces with an invisible character that looks like a space. I don't know if XBrowse can handle that character.
I just noticed that it appears that this is an item number. I always start item numbers with "1" plus however many zeros it takes to fill the field. Or, you could always make item numbers the same length by left padding them with zeros when needed. Either of these would solve your xbrowse problem.
Or, you could solve this without changes to the data file, you could define the column with strtran([fieldname]," ","0") . However, if this is an existing system this could cause problems if users try to type in leading zeros when searching for item numbers.
Or, with an existing system you could just replace all the item numbers in the file with strtran([fieldname]," ","0"). However, for awhile there would be a lot of confusion by users. Pre-existing documents would have no leading zeros, and new documents would. It could also create problems with existing item numbers in other files, like invoices etc. You would have to find and change all them too.
These are reasons why I always use item numbers of equal lengths.
The simplest thing to do is just ALIGN RIGHT.
Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10