>>>>>Hi,
>>>>>
>>>>>I have a code in the program that converts a string of numbers (not a number but a string of numbers) according to the second parameter of Transform(). For example,
>>>>>
>>>>>nNumber = 67849
>>>>>cMask = 'M XXXXXXXXXX'
>>>>>cNumber = transform( alltrim(str(nNumber)) + "@R" + cMask)
>>>>>*-- the result, cNumber, should be 'M 67849'
>>>>>
>>>>>
>>>>>The above works unless the cMask is 'A XXXXXXXXXX'
>>>>>
>>>>>Why does the 'A' make a difference?
>>>>>
>>>>>TIA
>>>>
>>>>Hi,
>>>>
>>>>following works for me:
>>>>
>>>>
>>>>lcMask = "9 9999"
>>>>lnNumber =67849
>>>>? transform( m.lnNumber , "@R "+ m.lcMask)
>>>>
>>>>Regards,
>>>>Koen
>>>
>>>Thank you, Koen. The reason my code didn't work is because I have a letter (specifically 'A') in my lcMask.
>>
>>Because "A" is valid mask letter:
>>Check InputMask in HELP.
>>The same is with letter "W"
>
>Thank you. I will be changing my approach from "@R " since I cannot tell customers what letter they can or cannot use.
Do this:
lcMask = "A XXXXXXX"
lnNumber =67849
lcNumber = CHRTRAN(transform( ALLTRIM(STR(m.lnNumber) , "@R "+ m.lcMask),[A],[A])
Other approach:
lcMask = "XXXXXXX"
lnNumber =67849
lcNumber = transform(ALLTRIM(STR(m.lnNumber) , m.lcMask)
lcNumber = [A ]+lcNumber
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.