Skip to Content
0

Validation message with expression using computed fields

Dec 08, 2016 at 08:55 AM

233

avatar image

Hi,

I use PB 12.1 (Build 6807) but have same issue with PB 12.5.2 (Build 5550).

I want to use an expression in a datawindow validation message.

A simple example (mine is more complex): if (number (gettext()) < c, 'Test', 'Hallo')

All works fine if c is a column. Powerbuilder shows the expression result Test or Hallo depending from input.

But I want the message depending on a computed field. If c is a computed field powerbuilder shows the validation expression instead of expression result. So the message is:

if (number (gettext()) < c, 'Test', 'Hallo')

It doesn't matter whats the expression in the computed field. Also a simple value causes this behavior.

Is this a bug or a feature? Any workarounds?

(In my real case I want to check a column value with pos against a computed field with a list of values. I don't want to use a column for that list.)

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

3 Answers

Best Answer
avatar image
Former Member Dec 09, 2016 at 12:15 PM
0

for non constant expression, lets complicate it :) :

if (number (gettext()) < number (describe ("evaluate('c', getrow())")), 'Test', 'Hallo')

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Oh yes, a nightmare. :-)

correct statement is:

if (number (gettext()) < number (describe ("evaluate('c', " + string (getrow()) + ")")), 'Test', 'Hallo')

Why simply if you can do it more complicated. :-)

0
avatar image
Former Member Dec 08, 2016 at 12:48 PM
0

how about :

if (number (gettext()) < number ( c ), 'Test', 'Hallo')

Show 1 Share
10 |10000 characters needed characters left characters exceeded

I can't set this: "Expecting STRING expression"

Thanks!

0
René Ullrich Dec 08, 2016 at 03:00 PM
0

My current workaround (works only because I have a constant value in expression):

if (number (gettext()) < number (describe ('c.expression')), 'Test', 'Hallo')

OMG :-)

Share
10 |10000 characters needed characters left characters exceeded