Skip to Content

Validation message with expression using computed fields

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

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

    for non constant expression, lets complicate it :) :

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

    Add comment
    10|10000 characters needed 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. :-)

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

    how about :

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

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 08, 2016 at 03:00 PM

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

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

    OMG :-)

    Add comment
    10|10000 characters needed characters exceeded