Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Computed field:how to obtain values

427 views
Skip to first unread message

Lana

unread,
Dec 9, 1997, 3:00:00 AM12/9/97
to

Hi,
We have a problem how to obtain values from computed fields but the
names of computed fields are unknown at run-time.
We tried with Describe function and Evaluate expression but it doesn't
return value for more complex expressions.
For example:
The computed field expressions:
first_name + space(2) + last_name - it works
first_name + char(asc(',')) + space(1) + last_name - it doesn't work
first_name + ',' + last_name - doesn't work

Thanks in advance

Lana Zoric

Anthony M. Perugini

unread,
Dec 9, 1997, 3:00:00 AM12/9/97
to

Lana,

When you create the computed field on the datawindow, you can give it a
name in it's properties sheet. Using the name, you can use the GetItemxxx()
functions to obtain the value.
hth,
--
Anthony M. Perugini
Principal Consultant
CPDP, CPI, CSPdba, MCPS
Pinnacle Decision Systems Inc. www.pinndec.com
aper...@pinndec.com

Lana wrote in message <348D6E...@newstar-tech.com>...


end


Anthony M Perugini.vcf

Saxon D'Aubin

unread,
Dec 10, 1997, 3:00:00 AM12/10/97
to

Lana wrote in message <348D6E...@newstar-tech.com>...
>Hi,
>We have a problem how to obtain values from computed fields but the
>names of computed fields are unknown at run-time.


I already replied to this message but it didn't seem to post. It sounds
like the quotes in your statement are giving you a problem since


first_name + space(2) + last_name

works
and first_name + char(asc(',')) + space(1) + last_name doesn't
work

Try ~" in place of single quotes, such as
first_name + char(asc(~",~")) + space(1) + last_name

- Saxon

R. Jamie White

unread,
Dec 17, 1997, 3:00:00 AM12/17/97
to

Here's something similiar I've been working on. This will work for the two
examples
you give. However for anything more complicated, some serious parsing will
be needed to get the
quotes alternating correctly within the expression. If you come up with a
parser for handleing
multiple levels of nested quotes, I'd appreciate it.

This expression would fail ls_expression = " '------"ouch"-------' +
string(123) "

This is the format for evaluating an expresion describe( "evaluate( '
expression ', ll_row)" ).
It seems that as long as the initial two levels of quotes are in this
format evaluate works, but otherwise
it fails.


string ls_expression
string ls_eval
//Using a computed field
//Evaluate is a fussy function.
// 1.ls_expression must be enclosed within single quotes.
// 2.each nested quote level within must alternate double or single
quotes.

ls_expression = my_datastore.describe( as_col + '.expression' )
//Replace single quotes with double quotes. I'VE PUT IN SPACES FOR
READABILITY
DO WHILE MATCH( ls_expression, " ' ")
ls_expression = REPLACE( ls_expression, POS( ls_expression, " ' "), 1, '
" ' )
LOOP

ls_eval = "evaluate( ~' " + ls_expression + " ~' , 1)"
la_ds_value = my_datastore.describe( ls_eval )

return la_ds_value

Jamie White

Lana <zor...@newstar-tech.com> wrote in article


<348D6E...@newstar-tech.com>...
> Hi,
> We have a problem how to obtain values from computed fields but the
> names of computed fields are unknown at run-time.

0 new messages