Subject Re: String question
From charlie <tm@tc.com>
Date Mon, 13 Nov 2023 12:57:45 -0500
Newsgroups dbase.getting-started

Hi Heinz..

I can't figure this one either.  

I want the result to be in character string but the val puts it in numeric.  

Example
c = "10000"
? transform(val(c), "@R 999,999")
This does come up with 10,000 but in numeric.
I tried this str(c) afterward but that doesn't work.

Unless I am missing something.

Heinz Kesting Wrote:

> Hi Charlie,
> > Say you have a string such as a = "1000"
> > I am using numbers in string form for a specific reason.
> >
> > I would like to add a comma like this...  "1,000"
> >
> > The data is in a form grid.  I was thinking I could use the function or picture properties of the column to do this but haven't been able to figure that out.  Is that possible or is there some other way to do this?
>
> You could use the transform() function with picture symbols. As you work
> in a grid, you probably have to use the beforeGetValue event of the
> rowset's field.
>
> Here's a first example to play with in the IDE, outside the grid and
> form. Once you have it working for your needs here, you can start to
> implement it into the the grid ...
>
> c = "1000"
> ? transform(val(c), "@R 999,999")
>
> returns for me
>     1.000
>
> The inserted delimiter depends on your setting for the numeric
> separator, for me the German format and setting would display like
> 1.000.000
>
> for the numeric value One Million.
>
> Please read the help for the picture and funtion, transform() and
> eventually beforeGetValue() for more information and examples.
>
> Hope this helps,
> Kind reagrds, Heinz
>