cancel
Showing results for 
Search instead for 
Did you mean: 

Validation message with expression using computed fields

Former Member
0 Kudos

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.)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

for non constant expression, lets complicate it 🙂 :

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

Former Member
0 Kudos

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. 🙂

Answers (2)

Answers (2)

Former Member
0 Kudos

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

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

OMG 🙂

Former Member
0 Kudos

how about :

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

Former Member
0 Kudos

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

Thanks!