Computed field expressions

Hi all,

I have a problem with computed expressions. I am replacing
occurence of a particular string in a computed field with
another string( say from 'mm/dd/yy ' to 'dd/mm/yy') using
powerscript and when I try to modify the expression it works
in some cases and fails in other cases. For ex

ls_syntax =    ls_computename + ".Expression =  " +  "'"+
ls_expression + "'"

this.modify(ls_syntax)	

In the above I get a Modify Syntax error in some cases.

Therefore, I need a universal syntax that would work under
all cases. Does anyone have the answer.

Thanks,
SS
0
SS
1/20/2005 11:05:40 PM
sybase.powerbuilder.datawindow 28057 articles. 4 followers. Follow

9 Replies
387 Views

Similar Articles

[PageSpeed] 9

Hi all

Why dont you store this string (in this case a mask) in a (fake) column ?? 
Then the only thing you have to do is a SetItem with the appropiate value.

Regards
Juli�n

<SS> wrote in message news:41f03944.1805.1681692777@sybase.com...
> Hi all,
>
> I have a problem with computed expressions. I am replacing
> occurence of a particular string in a computed field with
> another string( say from 'mm/dd/yy ' to 'dd/mm/yy') using
> powerscript and when I try to modify the expression it works
> in some cases and fails in other cases. For ex
>
> ls_syntax =    ls_computename + ".Expression =  " +  "'"+
> ls_expression + "'"
>
> this.modify(ls_syntax)
>
> In the above I get a Modify Syntax error in some cases.
>
> Therefore, I need a universal syntax that would work under
> all cases. Does anyone have the answer.
>
> Thanks,
> SS 


0
Juli
1/21/2005 12:12:35 PM
Hi,

there's no further generalization than you have yet, maybe only
a simplifacation:

ls_syntax=ls_computename + ".Expression= '" + ls_expression + "'"

If you get an error either the expression in ls_expression or
the ls_computename is wrong. Showing some samples where
it fails may help us to help you.

Chris Werner

<SS> schrieb im Newsbeitrag news:41f03944.1805.1681692777@sybase.com...
> Hi all,
>
> I have a problem with computed expressions. I am replacing
> occurence of a particular string in a computed field with
> another string( say from 'mm/dd/yy ' to 'dd/mm/yy') using
> powerscript and when I try to modify the expression it works
> in some cases and fails in other cases. For ex
>
> ls_syntax =    ls_computename + ".Expression =  " +  "'"+
> ls_expression + "'"
>
> this.modify(ls_syntax)
>
> In the above I get a Modify Syntax error in some cases.
>
> Therefore, I need a universal syntax that would work under
> all cases. Does anyone have the answer.
>
> Thanks,
> SS


0
Chris
1/21/2005 12:40:25 PM
Hi,

Ok, I 'll give an example. The expression I specified would
fail in the below example.

'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
String ( rd_to_date, "mm/dd/yy").

It would work if I use double quotes ie "From" instead of
'From'. As there are plenty of such reports and it would be
extremely time consuming to test every report and change the
computed expression inside the datawindow. That is why I
wanted a syntax that would be universally applicable. I know
that using  ~ would make it work. But I don't know how to
specify the ~ in the ls_syntax.

Thanks,
SS



> Hi,
>
> there's no further generalization than you have yet, maybe
> only a simplifacation:
>
> ls_syntax=ls_computename + ".Expression= '" +
> ls_expression + "'"
>
> If you get an error either the expression in ls_expression
> or the ls_computename is wrong. Showing some samples where
> it fails may help us to help you.
>
> Chris Werner
>
> <SS> schrieb im Newsbeitrag
> > news:41f03944.1805.1681692777@sybase.com... Hi all,
> >
> > I have a problem with computed expressions. I am
> > replacing occurence of a particular string in a computed
> > field with another string( say from 'mm/dd/yy ' to
> > 'dd/mm/yy') using powerscript and when I try to modify
> > the expression it works in some cases and fails in other
> cases. For ex >
> > ls_syntax =    ls_computename + ".Expression =  " +
> > "'"+ ls_expression + "'"
> >
> > this.modify(ls_syntax)
> >
> > In the above I get a Modify Syntax error in some cases.
> >
> > Therefore, I need a universal syntax that would work
> > under all cases. Does anyone have the answer.
> >
> > Thanks,
> > SS
>
>
0
SS
1/21/2005 3:44:18 PM
I suggest you look at the section "Quotes and tildes" in the Help for
Modify.

<SS> wrote in message news:41f12352.2306.1681692777@sybase.com...
> Hi,
>
> Ok, I 'll give an example. The expression I specified would
> fail in the below example.
>
> 'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> String ( rd_to_date, "mm/dd/yy").
>
> It would work if I use double quotes ie "From" instead of
> 'From'. As there are plenty of such reports and it would be
> extremely time consuming to test every report and change the
> computed expression inside the datawindow. That is why I
> wanted a syntax that would be universally applicable. I know
> that using  ~ would make it work. But I don't know how to
> specify the ~ in the ls_syntax.
>
> Thanks,
> SS
>
>
>
> > Hi,
> >
> > there's no further generalization than you have yet, maybe
> > only a simplifacation:
> >
> > ls_syntax=ls_computename + ".Expression= '" +
> > ls_expression + "'"
> >
> > If you get an error either the expression in ls_expression
> > or the ls_computename is wrong. Showing some samples where
> > it fails may help us to help you.
> >
> > Chris Werner
> >
> > <SS> schrieb im Newsbeitrag
> > > news:41f03944.1805.1681692777@sybase.com... Hi all,
> > >
> > > I have a problem with computed expressions. I am
> > > replacing occurence of a particular string in a computed
> > > field with another string( say from 'mm/dd/yy ' to
> > > 'dd/mm/yy') using powerscript and when I try to modify
> > > the expression it works in some cases and fails in other
> > cases. For ex >
> > > ls_syntax =    ls_computename + ".Expression =  " +
> > > "'"+ ls_expression + "'"
> > >
> > > this.modify(ls_syntax)
> > >
> > > In the above I get a Modify Syntax error in some cases.
> > >
> > > Therefore, I need a universal syntax that would work
> > > under all cases. Does anyone have the answer.
> > >
> > > Thanks,
> > > SS
> >
> >


0
Jerry
1/21/2005 4:03:44 PM
Hi,

if you use single quotes to enclose your expression
you should use double quotes inside the expression
if ever possible, live will be easier. If you NEED
single quotes inside the expression you have to
ensure that every single quote is escaped by a tilde.
So your effective expression must be

~'From ~' + String( rd_from_date, "mm/dd/yy" ) + " To " +
String ( rd_to_date, "mm/dd/yy")

Because the tilde is an escape character in powerscript
too, you have to escape it on usage:

ls_expr="~~'From ~~' + String( rd_from_date, ~"mm/dd/yy~" ) + ~" To ~" +
String ( rd_to_date, ~"mm/dd/yy~")"

The tildes before the double quotes act as escape
character for the double quote, escaping from the
interpretation as indicator of the end of the string.

Because this tilde quote code is confusing you
should check the result carefully. Rule of thumb:
The outer quoute type (single or double) should
not arise inside of the expression.

Good luck

    Chris Werner


<SS> schrieb im Newsbeitrag news:41f12352.2306.1681692777@sybase.com...
> Hi,
>
> Ok, I 'll give an example. The expression I specified would
> fail in the below example.
>
> 'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> String ( rd_to_date, "mm/dd/yy").
>
> It would work if I use double quotes ie "From" instead of
> 'From'. As there are plenty of such reports and it would be
> extremely time consuming to test every report and change the
> computed expression inside the datawindow. That is why I
> wanted a syntax that would be universally applicable. I know
> that using  ~ would make it work. But I don't know how to
> specify the ~ in the ls_syntax.
>
> Thanks,
> SS
>
>
>
> > Hi,
> >
> > there's no further generalization than you have yet, maybe
> > only a simplifacation:
> >
> > ls_syntax=ls_computename + ".Expression= '" +
> > ls_expression + "'"
> >
> > If you get an error either the expression in ls_expression
> > or the ls_computename is wrong. Showing some samples where
> > it fails may help us to help you.
> >
> > Chris Werner
> >
> > <SS> schrieb im Newsbeitrag
> > > news:41f03944.1805.1681692777@sybase.com... Hi all,
> > >
> > > I have a problem with computed expressions. I am
> > > replacing occurence of a particular string in a computed
> > > field with another string( say from 'mm/dd/yy ' to
> > > 'dd/mm/yy') using powerscript and when I try to modify
> > > the expression it works in some cases and fails in other
> > cases. For ex >
> > > ls_syntax =    ls_computename + ".Expression =  " +
> > > "'"+ ls_expression + "'"
> > >
> > > this.modify(ls_syntax)
> > >
> > > In the above I get a Modify Syntax error in some cases.
> > >
> > > Therefore, I need a universal syntax that would work
> > > under all cases. Does anyone have the answer.
> > >
> > > Thanks,
> > > SS
> >
> >


0
Chris
1/21/2005 4:26:35 PM
Hi,

Thanks for your clarification. But how would specify ~ in
the generic expression


ls_syntax =    ls_computename + ".Expression =  " +
 "'"+ ls_expression + "'"

Thanks,
SS
> Hi,
>
> if you use single quotes to enclose your expression
> you should use double quotes inside the expression
> if ever possible, live will be easier. If you NEED
> single quotes inside the expression you have to
> ensure that every single quote is escaped by a tilde.
> So your effective expression must be
>
> ~'From ~' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> String ( rd_to_date, "mm/dd/yy")
>
> Because the tilde is an escape character in powerscript
> too, you have to escape it on usage:
>
> ls_expr="~~'From ~~' + String( rd_from_date, ~"mm/dd/yy~"
> ) + ~" To ~" + String ( rd_to_date, ~"mm/dd/yy~")"
>
> The tildes before the double quotes act as escape
> character for the double quote, escaping from the
> interpretation as indicator of the end of the string.
>
> Because this tilde quote code is confusing you
> should check the result carefully. Rule of thumb:
> The outer quoute type (single or double) should
> not arise inside of the expression.
>
> Good luck
>
>     Chris Werner
>
>
> <SS> schrieb im Newsbeitrag
> > news:41f12352.2306.1681692777@sybase.com... Hi,
> >
> > Ok, I 'll give an example. The expression I specified
> > would fail in the below example.
> >
> > 'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> > String ( rd_to_date, "mm/dd/yy").
> >
> > It would work if I use double quotes ie "From" instead
> > of 'From'. As there are plenty of such reports and it
> > would be extremely time consuming to test every report
> > and change the computed expression inside the
> > datawindow. That is why I wanted a syntax that would be
> > universally applicable. I know that using  ~ would make
> > it work. But I don't know how to specify the ~ in the
> ls_syntax. >
> > Thanks,
> > SS
> >
> >
> >
> > > Hi,
> > >
> > > there's no further generalization than you have yet,
> > > maybe only a simplifacation:
> > >
> > > ls_syntax=ls_computename + ".Expression= '" +
> > > ls_expression + "'"
> > >
> > > If you get an error either the expression in
> > > ls_expression or the ls_computename is wrong. Showing
> > > some samples where it fails may help us to help you.
> > >
> > > Chris Werner
> > >
> > > <SS> schrieb im Newsbeitrag
> > > > news:41f03944.1805.1681692777@sybase.com... Hi all,
> > > >
> > > > I have a problem with computed expressions. I am
> > > > replacing occurence of a particular string in a
> > > > computed field with another string( say from
> > > > 'mm/dd/yy ' to 'dd/mm/yy') using powerscript and
> > > > when I try to modify the expression it works in some
> > > cases and fails in other cases. For ex >
> > > > ls_syntax =    ls_computename + ".Expression =  " +
> > > > "'"+ ls_expression + "'"
> > > >
> > > > this.modify(ls_syntax)
> > > >
> > > > In the above I get a Modify Syntax error in some
> > > cases. >
> > > > Therefore, I need a universal syntax that would work
> > > > under all cases. Does anyone have the answer.
> > > >
> > > > Thanks,
> > > > SS
> > >
> > >
>
>
0
SS
1/21/2005 4:38:53 PM
Hi,

not possible to specify the quote in the generic
expression because it may be needed in the
concrete expression (ls_expression). If I think
right about your code you could replace every
single quote in ls_expression with a tilde
followd by a single quote. Of yourse only if
there is no tilde in front of the single quote in
question. This may work in MOST cases.
The code looks like this:

ll_p = pos(ls_expr, "'")
do while ll_p > 0

    if ll_p = 1 then
        ls_expr = replace(ls_expr, ll_p, 1, "~~'")
        ll_p = ll_p + 1
    elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
        ls_expr = replace(ls_expr, ll_p, 1, "~~'")
        ll_p = ll_p + 1
    end if
    ll_p = pos(ls_expr, "'", ll_p)

loop

ls_syntax =
....

HTH

    Chris Werner



<SS> schrieb im Newsbeitrag news:41f13019.bd4.1681692777@sybase.com...
> Hi,
>
> Thanks for your clarification. But how would specify ~ in
> the generic expression
>
>
> ls_syntax =    ls_computename + ".Expression =  " +
>  "'"+ ls_expression + "'"
>
> Thanks,
> SS
> > Hi,
> >
> > if you use single quotes to enclose your expression
> > you should use double quotes inside the expression
> > if ever possible, live will be easier. If you NEED
> > single quotes inside the expression you have to
> > ensure that every single quote is escaped by a tilde.
> > So your effective expression must be
> >
> > ~'From ~' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> > String ( rd_to_date, "mm/dd/yy")
> >
> > Because the tilde is an escape character in powerscript
> > too, you have to escape it on usage:
> >
> > ls_expr="~~'From ~~' + String( rd_from_date, ~"mm/dd/yy~"
> > ) + ~" To ~" + String ( rd_to_date, ~"mm/dd/yy~")"
> >
> > The tildes before the double quotes act as escape
> > character for the double quote, escaping from the
> > interpretation as indicator of the end of the string.
> >
> > Because this tilde quote code is confusing you
> > should check the result carefully. Rule of thumb:
> > The outer quoute type (single or double) should
> > not arise inside of the expression.
> >
> > Good luck
> >
> >     Chris Werner
> >
> >
> > <SS> schrieb im Newsbeitrag
> > > news:41f12352.2306.1681692777@sybase.com... Hi,
> > >
> > > Ok, I 'll give an example. The expression I specified
> > > would fail in the below example.
> > >
> > > 'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> > > String ( rd_to_date, "mm/dd/yy").
> > >
> > > It would work if I use double quotes ie "From" instead
> > > of 'From'. As there are plenty of such reports and it
> > > would be extremely time consuming to test every report
> > > and change the computed expression inside the
> > > datawindow. That is why I wanted a syntax that would be
> > > universally applicable. I know that using  ~ would make
> > > it work. But I don't know how to specify the ~ in the
> > ls_syntax. >
> > > Thanks,
> > > SS
> > >
> > >
> > >
> > > > Hi,
> > > >
> > > > there's no further generalization than you have yet,
> > > > maybe only a simplifacation:
> > > >
> > > > ls_syntax=ls_computename + ".Expression= '" +
> > > > ls_expression + "'"
> > > >
> > > > If you get an error either the expression in
> > > > ls_expression or the ls_computename is wrong. Showing
> > > > some samples where it fails may help us to help you.
> > > >
> > > > Chris Werner
> > > >
> > > > <SS> schrieb im Newsbeitrag
> > > > > news:41f03944.1805.1681692777@sybase.com... Hi all,
> > > > >
> > > > > I have a problem with computed expressions. I am
> > > > > replacing occurence of a particular string in a
> > > > > computed field with another string( say from
> > > > > 'mm/dd/yy ' to 'dd/mm/yy') using powerscript and
> > > > > when I try to modify the expression it works in some
> > > > cases and fails in other cases. For ex >
> > > > > ls_syntax =    ls_computename + ".Expression =  " +
> > > > > "'"+ ls_expression + "'"
> > > > >
> > > > > this.modify(ls_syntax)
> > > > >
> > > > > In the above I get a Modify Syntax error in some
> > > > cases. >
> > > > > Therefore, I need a universal syntax that would work
> > > > > under all cases. Does anyone have the answer.
> > > > >
> > > > > Thanks,
> > > > > SS
> > > >
> > > >
> >
> >


0
Chris
1/21/2005 4:57:09 PM
> ll_p = pos(ls_expr, "'")
> do while ll_p > 0
>
>     if ll_p = 1 then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p = ll_p + 1
>     elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p = ll_p + 1
>     end if
>     ll_p = pos(ls_expr, "'", ll_p)
>
> loop

Oops, this never terminates. This one is
better:

ll_p = pos(ls_expr, "'")
do while ll_p > 0

    if ll_p = 1 then
        ls_expr = replace(ls_expr, ll_p, 1, "~~'")
        ll_p ++
    elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
        ls_expr = replace(ls_expr, ll_p, 1, "~~'")
        ll_p ++
    end if

    ll_p ++
    ll_p = pos(ls_expr, "'", ll_p)

loop




"Chris Werner" <cw[please_no_spam]@f-s.de> schrieb im Newsbeitrag
news:41f13465$1@forums-1-dub...
> Hi,
>
> not possible to specify the quote in the generic
> expression because it may be needed in the
> concrete expression (ls_expression). If I think
> right about your code you could replace every
> single quote in ls_expression with a tilde
> followd by a single quote. Of yourse only if
> there is no tilde in front of the single quote in
> question. This may work in MOST cases.
> The code looks like this:
>
> ll_p = pos(ls_expr, "'")
> do while ll_p > 0
>
>     if ll_p = 1 then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p = ll_p + 1
>     elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p = ll_p + 1
>     end if
>     ll_p = pos(ls_expr, "'", ll_p)
>
> loop
>
> ls_syntax =
> ...
>
> HTH
>
>     Chris Werner
>
>
>
> <SS> schrieb im Newsbeitrag news:41f13019.bd4.1681692777@sybase.com...
> > Hi,
> >
> > Thanks for your clarification. But how would specify ~ in
> > the generic expression
> >
> >
> > ls_syntax =    ls_computename + ".Expression =  " +
> >  "'"+ ls_expression + "'"
> >
> > Thanks,
> > SS
> > > Hi,
> > >
> > > if you use single quotes to enclose your expression
> > > you should use double quotes inside the expression
> > > if ever possible, live will be easier. If you NEED
> > > single quotes inside the expression you have to
> > > ensure that every single quote is escaped by a tilde.
> > > So your effective expression must be
> > >
> > > ~'From ~' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> > > String ( rd_to_date, "mm/dd/yy")
> > >
> > > Because the tilde is an escape character in powerscript
> > > too, you have to escape it on usage:
> > >
> > > ls_expr="~~'From ~~' + String( rd_from_date, ~"mm/dd/yy~"
> > > ) + ~" To ~" + String ( rd_to_date, ~"mm/dd/yy~")"
> > >
> > > The tildes before the double quotes act as escape
> > > character for the double quote, escaping from the
> > > interpretation as indicator of the end of the string.
> > >
> > > Because this tilde quote code is confusing you
> > > should check the result carefully. Rule of thumb:
> > > The outer quoute type (single or double) should
> > > not arise inside of the expression.
> > >
> > > Good luck
> > >
> > >     Chris Werner
> > >
> > >
> > > <SS> schrieb im Newsbeitrag
> > > > news:41f12352.2306.1681692777@sybase.com... Hi,
> > > >
> > > > Ok, I 'll give an example. The expression I specified
> > > > would fail in the below example.
> > > >
> > > > 'From ' + String( rd_from_date, "mm/dd/yy" ) + " To " +
> > > > String ( rd_to_date, "mm/dd/yy").
> > > >
> > > > It would work if I use double quotes ie "From" instead
> > > > of 'From'. As there are plenty of such reports and it
> > > > would be extremely time consuming to test every report
> > > > and change the computed expression inside the
> > > > datawindow. That is why I wanted a syntax that would be
> > > > universally applicable. I know that using  ~ would make
> > > > it work. But I don't know how to specify the ~ in the
> > > ls_syntax. >
> > > > Thanks,
> > > > SS
> > > >
> > > >
> > > >
> > > > > Hi,
> > > > >
> > > > > there's no further generalization than you have yet,
> > > > > maybe only a simplifacation:
> > > > >
> > > > > ls_syntax=ls_computename + ".Expression= '" +
> > > > > ls_expression + "'"
> > > > >
> > > > > If you get an error either the expression in
> > > > > ls_expression or the ls_computename is wrong. Showing
> > > > > some samples where it fails may help us to help you.
> > > > >
> > > > > Chris Werner
> > > > >
> > > > > <SS> schrieb im Newsbeitrag
> > > > > > news:41f03944.1805.1681692777@sybase.com... Hi all,
> > > > > >
> > > > > > I have a problem with computed expressions. I am
> > > > > > replacing occurence of a particular string in a
> > > > > > computed field with another string( say from
> > > > > > 'mm/dd/yy ' to 'dd/mm/yy') using powerscript and
> > > > > > when I try to modify the expression it works in some
> > > > > cases and fails in other cases. For ex >
> > > > > > ls_syntax =    ls_computename + ".Expression =  " +
> > > > > > "'"+ ls_expression + "'"
> > > > > >
> > > > > > this.modify(ls_syntax)
> > > > > >
> > > > > > In the above I get a Modify Syntax error in some
> > > > > cases. >
> > > > > > Therefore, I need a universal syntax that would work
> > > > > > under all cases. Does anyone have the answer.
> > > > > >
> > > > > > Thanks,
> > > > > > SS
> > > > >
> > > > >
> > >
> > >
>
>


0
Chris
1/21/2005 5:04:44 PM
Hi chris,

I too got an endless loop and was about to compose my
response.
Anyway, I will try the new logic you sent and get back if I
encounter problems.Thanks so much for your help.

SS

> > ll_p = pos(ls_expr, "'")
> > do while ll_p > 0
> >
> >     if ll_p = 1 then
> >         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
> >         ll_p = ll_p + 1
> >     elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
> >         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
> >         ll_p = ll_p + 1
> >     end if
> >     ll_p = pos(ls_expr, "'", ll_p)
> >
> > loop
>
> Oops, this never terminates. This one is
> better:
>
> ll_p = pos(ls_expr, "'")
> do while ll_p > 0
>
>     if ll_p = 1 then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p ++
>     elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
>         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
>         ll_p ++
>     end if
>
>     ll_p ++
>     ll_p = pos(ls_expr, "'", ll_p)
>
> loop
>
>
>
>
> "Chris Werner" <cw[please_no_spam]@f-s.de> schrieb im
> Newsbeitrag news:41f13465$1@forums-1-dub...
> > Hi,
> >
> > not possible to specify the quote in the generic
> > expression because it may be needed in the
> > concrete expression (ls_expression). If I think
> > right about your code you could replace every
> > single quote in ls_expression with a tilde
> > followd by a single quote. Of yourse only if
> > there is no tilde in front of the single quote in
> > question. This may work in MOST cases.
> > The code looks like this:
> >
> > ll_p = pos(ls_expr, "'")
> > do while ll_p > 0
> >
> >     if ll_p = 1 then
> >         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
> >         ll_p = ll_p + 1
> >     elseif mid(ls_expr, ll_p - 1, 1) <> "~~" then
> >         ls_expr = replace(ls_expr, ll_p, 1, "~~'")
> >         ll_p = ll_p + 1
> >     end if
> >     ll_p = pos(ls_expr, "'", ll_p)
> >
> > loop
> >
> > ls_syntax =
> > ...
> >
> > HTH
> >
> >     Chris Werner
> >
> >
> >
> > <SS> schrieb im Newsbeitrag
> > > news:41f13019.bd4.1681692777@sybase.com... Hi,
> > >
> > > Thanks for your clarification. But how would specify ~
> > > in the generic expression
> > >
> > >
> > > ls_syntax =    ls_computename + ".Expression =  " +
> > >  "'"+ ls_expression + "'"
> > >
> > > Thanks,
> > > SS
> > > > Hi,
> > > >
> > > > if you use single quotes to enclose your expression
> > > > you should use double quotes inside the expression
> > > > if ever possible, live will be easier. If you NEED
> > > > single quotes inside the expression you have to
> > > > ensure that every single quote is escaped by a
> > > > tilde. So your effective expression must be
> > > >
> > > > ~'From ~' + String( rd_from_date, "mm/dd/yy" ) + "
> > > > To " + String ( rd_to_date, "mm/dd/yy")
> > > >
> > > > Because the tilde is an escape character in
> > > > powerscript too, you have to escape it on usage:
> > > >
> > > > ls_expr="~~'From ~~' + String( rd_from_date,
> > > > ~"mm/dd/yy~" ) + ~" To ~" + String ( rd_to_date,
> > > ~"mm/dd/yy~")" >
> > > > The tildes before the double quotes act as escape
> > > > character for the double quote, escaping from the
> > > > interpretation as indicator of the end of the
> > > string. >
> > > > Because this tilde quote code is confusing you
> > > > should check the result carefully. Rule of thumb:
> > > > The outer quoute type (single or double) should
> > > > not arise inside of the expression.
> > > >
> > > > Good luck
> > > >
> > > >     Chris Werner
> > > >
> > > >
> > > > <SS> schrieb im Newsbeitrag
> > > > > news:41f12352.2306.1681692777@sybase.com... Hi,
> > > > >
> > > > > Ok, I 'll give an example. The expression I
> > > > > specified would fail in the below example.
> > > > >
> > > > > 'From ' + String( rd_from_date, "mm/dd/yy" ) + "
> > > > > To " + String ( rd_to_date, "mm/dd/yy").
> > > > >
> > > > > It would work if I use double quotes ie "From"
> > > > > instead of 'From'. As there are plenty of such
> > > > > reports and it would be extremely time consuming
> > > > > to test every report and change the computed
> > > > > expression inside the datawindow. That is why I
> > > > > wanted a syntax that would be universally
> > > > > applicable. I know that using  ~ would make it
> > > > work. But I don't know how to specify the ~ in the
> > > > > ls_syntax. > Thanks,
> > > > > SS
> > > > >
> > > > >
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > there's no further generalization than you have
> > > > > > yet, maybe only a simplifacation:
> > > > > >
> > > > > > ls_syntax=ls_computename + ".Expression= '" +
> > > > > > ls_expression + "'"
> > > > > >
> > > > > > If you get an error either the expression in
> > > > > > ls_expression or the ls_computename is wrong.
> > > > > > Showing some samples where it fails may help us
> > > > > to help you. >
> > > > > > Chris Werner
> > > > > >
> > > > > > <SS> schrieb im Newsbeitrag
> > > > > > > news:41f03944.1805.1681692777@sybase.com... Hi
> > > > > > all, >
> > > > > > > I have a problem with computed expressions. I
> > > > > > > am replacing occurence of a particular string
> > > > > > > in a computed field with another string( say
> > > > > > > from 'mm/dd/yy ' to 'dd/mm/yy') using
> > > > > > > powerscript and when I try to modify the
> > > > > > expression it works in some cases and fails in
> > > > > > > other cases. For ex > ls_syntax =
> > > > > > > ls_computename + ".Expression =  " + "'"+
> > > > > > ls_expression + "'" >
> > > > > > > this.modify(ls_syntax)
> > > > > > >
> > > > > > > In the above I get a Modify Syntax error in
> > > > > > some cases. >
> > > > > > > Therefore, I need a universal syntax that
> > > > > > > would work under all cases. Does anyone have
> > > > > > the answer. >
> > > > > > > Thanks,
> > > > > > > SS
> > > > > >
> > > > > >
> > > >
> > > >
> >
> >
>
>
0
SS
1/21/2005 5:28:35 PM
Reply:

Similar Artilces:

computed field of a computed field
Hello, I made nice datawindow with some aggregate functions to calculate a certain value at a group level. Now I want a grand total which gives me the sum of these values. Unfortunately this does not seem to be possible. So, when I have a computed field which is round (sum(file_field),0) located in the trailer band, I need a grand total of this field in the summary band. Does anyone know how to solve this ? Philip. Philip@acom.be (Belgium) Philip, in the group , you must have created a computed field having expression sum ( file_field ) for group 1 In the summery, y...

Datawindows and Computed Fields
I am using PB 8 and have several formatted datawindows providing reports for the end user. What has been requested of me and I am having trouble with is as follows. I have a datawindow with a nested datawindow. The main datawindow object contains the "parent" record and the nested one contains "child" records. Basically an Agency has subagencies. This report is to be used to create a manual. Where I am having the problem is that the page numbering is done using a computed field placed in the header (or footer or detail for that matter). I need to know the page...

Computed field in a datawindow
How do I make a computed field in a datawindow editable? You can't. But you can create computed column. It has a tab order. Go to SQL painter of datawindow, go to computed, place 0 for number type of editable column, '' for string type of editable column -- Mahendra Dhamdhere, CPDA Email:nospam_mahendrad@hotmail.com Pl. Remove nospam_ from email id Shobana Juliana wrote: > How do I make a computed field in a datawindow editable? >How do I make a computed field in a datawindow editable? You don't. If you need for the user to be able to e...

computed field expression
I have this statement but it is not producing the desired results. I have 2 computed fields that are supposed to get the total amount for cash and the total for credit. compute_1: If( payment_payment_form <> 'cash', sum( payment_amount for all),0) compute_2: If ( payment_payment_form ='cash, sum( payment_amount for all),0) Obviously this aboue just produces the total for both cash and credit. I can't get the syntax right but I need something like; If ( payment_payment_form ='cash, sum( payment_amount for all) where payment_form = cash,0) Any ideas?...

Computed field expression: AND or OR
Hi all, Just had a strange problem. In a computed field expression I placed following statement: (Value of prc_discount = 0 ) - IF( NOT IsNull( prc_discount ) AND prc_discount <> 0, 'Show text', '' ) --> Result = 'Show text' Now by changing the expression to: - IF( IsNull( prc_discount ) OR prc_discount = 0, '', 'Show text' ) --> Result = '' Can someone explain this behaviour, because I'm totally lost. (PB 8.0.1 Build 9056 on a W2K workstation) TIA, PascalB Hi Pascal, just a shot in the dark: ...

Computed field in Datawindow
PB version: 6.5 A computed field in a datawindow have not a tab order. So, i can�t go to this field and do a 'Copy and Paste' of the value of this field. Thanks... try to use computed column, u can't use computed field for copy & paste as it does not have tab order, it is only for display. ...

Computing Computed Field
I Have a computed field in tailor band of a group. I tried to sum that computed field in summary band using another computed expression ..It is displaying 0 instead of sum I appreciated any help Thanks Sue IF you use the format sum(x for group 1) in Tailor group then use sum(x for all) in summary. Stephan Donati Fortisoft Corporation "Sue Sambireddy" <SSambireddy@bankofny.com> wrote in message news:3AE83A22.AF41D7BC@bankofny.com... > I Have a computed field in tailor band of a group. I tried to sum > that computed field in summary band using a...

Computing computed field
I Have a computed field in tailor band of a group. I tried to sum that computed field in summary band using another computed expression ..It is displaying 0 instead of sum . I appreciated any help Thanks Sue You can place the expression from the second field in the first one instead of referring to it. Another option (often works) is to apply the GroupCalc DataWindow method (of course outside the expression in the script where you issue Retrieve(), for example.). Sue Sambireddy wrote: > I Have a computed field in tailor band of a group. I tried to sum > t...

Computed Field not computing
I have a series of computed fields that calculate percentages and then a series that total those percentages. When I add the third total percentage field (out of four total) to my group trailer, all my total percentage fields sum to 0 when they should all sum to 100. If I move the third computed field into another band then they all sum to 100 and when I put it back they all still compute to 100. Why would this happen? I know computed fields constantly re-compute, but these are not initially computing correctly based on the number of computed fields present in my group trailer band...

summation of computed fields under datawindow
Just one quick & simple quesion. However, i do get stuck with this for a long time. How can i sum up the total of the computed fields? Example: ComField = sum (A for group 1) where A=column However, at the end of my report, i coded "sum(ComField for all)", i only got "0". Is there anyway syntax to sum the computed fields at the end of the report. Thanks in advance! Joe, You may have over-simplified your example, because you can just create a computed field with the expression "Sum (A for all)" and solve that particular problem. Is th...

Computed Field Expression #2
I have a computed field in the header band that I want to update with most current value of an instance variable. I am attempting to change the expression. It never displays. The modify statement returns an empty string showing me that the modify had no errors. What am I doing wrong and is there a better way to get an instance variable to display on a datawindow. Try a text object. It's simple. Just change the text. <DW Control Name>.Object.<Textname>.Text='<string>' -- Srinivas R. Loka "Rosalind Powell" <roz@brcf.org> wrote in m...

modify expressions in computed fields ?
Can i modify expressions in computed fields depends on the value in a column like other properties like color (exam: text.Color='0~t If (formel_id =1 ,255,0)' )?? thats my test_modstring: c_test.Expression='0~tIf(formel_id =1 ,1+1,0)' i have only Syntax error at the last column. Thank you very much! Sure you can. Off hand your syntax looks ok. Replace "forme1_id" with a constant and see if it accepts the syntax: '0~tIf(1=1 ,1+1,0)' First get it working in the DW painter. Then copy that syntax out and use it in your modify. Regards, John ...

Modifying Computed field Expression
Hello, We have a software package that we use in our business, where we have some control over customizations to the program. We don't have access to window objects, but we have access to certain datawindows and global functions. One global function runs when a window refreshes. The function contains a choose case statement to determine which window is opening. It then runs the script for that window. I have a computed field on a datawindow that just has an Expression of 0. I want to be able to have the Expression for the computed field get modified through this fun...

computed field conditional expression
Hi, I need to write a computed field to sum rows based on a condition, like a where clause. Like: sum( amount where level = 4) OR even better sum( amount where level = level), where 'level' and 'amount' are columns in the DW. Even though this computed field will be in the detail band, I want it to do some kind of grouping sum. I cant change the the expression for a row. TIA Sanjay Hi Geert, Thanks, I couldn't quite follow what you suggested. Could you elaborate. Let me elaborate. I want to sum a column lets say 'amount' and take only rows...

Web resources about - Computed field expressions - sybase.powerbuilder.datawindow

Expression (sign language) - Wikipedia, the free encyclopedia
Signs with two different expressions. The pursed lips and partly closed eyes on the left, and raised lip on the right, are necessary for proper ...

Joe Rogan's Facial Expression After Ronda Rousey Got Knocked Out Was Priceless - Bleacher Report
Joe Rogan 's face spoke for us all Saturday night. After UFC superstar Ronda Rousey got knocked out by a lethal kick from Holly Holm, the commentator ...

Jack Dorsey: 'Twitter stands for freedom of expression'
Newly-instated CEO Jack Dorsey laid out Twitter's commitment to open dialogue, in a keynote on stage at today's Twitter Flight developer conference ...

Make your technology a force for musical expression with this digital guitar
Computers, tablets, even iPhones have grown into powerful tools for music making, but for many who play guitar the bridge from analog instrument ...

Disney's FaceDirector changes facial expressions in movies
The new tool out of Disney Research's labs could turn an ing&eacute;nue's semi-decent attempt into a finely nuanced performance. This software ...

Turkey's YouTube Ban Violated Freedom Of Expression, European Court Rules
A YouTube ban in Turkey that lasted two years has now been ruled a violation of the European Convention on Human Rights. Back in 2008, a Turkish ...

At Public School Sports, A Constant Test of Line Between Faith Expression and Establishment
Thefine line between expressing religious faith at a government-run institution and said institution endorsing that expression, and the argument ...

Smile!: Impressive Real-Time Facial Expression Transfer
This is a video from Stanford University of a system developed to transfer one person's facial expressions in real time to a live video feed ...

How Facial Recognition Uses Super-Simple Patterns to Understand Your Expression
Facial recognition systems use all kinds of clever software to work out who you are and even how you’re feeling. But in this video explainer, ...

Expressions of Solidarity for France in Red, White and Blue
ABC News Expressions of Solidarity for France in Red, White and Blue ABC News This photograph made available on Saturday Nov. 14, 2015, shows ...

Resources last updated: 12/22/2015 6:18:23 PM