$valuepart($labelproperties(fieldname)) sometimes returns 0

Author: jbrown@canberra.com (jbrown)

In Uniface 9.4, I would like to display the label of a field in a grid widget in an error message. I am using the following code: $$gbr_msg1 = "%%$valuepart($labelproperties(building_id.gbl_buildings))%%% cannot be blank". Sometimes errormsg contains the actual label text, but sometimes in place of the label text there is a 0 (0 cannot be blank). I haven't been able to figure out why the label value changes. By the time this code is reached, the execute trigger has completed (e.g. the Presentation layer is available).

4 Comments

  1. .. think you should use $item("text",$labelproperties(...)) instead of $valrep, to be more specific what you want property you want.


    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Your suggestion is definitely a better way of coding. However, now I just get "cannot be blank". In other words, the $labelproperties for the field does not have the label text in it. I even put a show statement directly prior to the $item("text",$labelproperties(...))  statement. It seems as if the $labelproperties is set on an existing occurrence but not a newly added occurrence.


    Author: jbrown (jbrown@canberra.com)
  3. .. so one option is to collect the label texts of all fields once when the component starts into a list and take the information from that list.

     

    Another question: have your labels a "repeat" or "repeat if not empty" attribute ?


    Author: ulrich-merkel (ulrichmerkel@web.de)
  4. Labels in entities or grids are by default set to "do not repeat". Therefore label values for subsequent occurences are set to 0. I would suggest to right click on a label, select label and the choose option "repeat"

    Devy


    Author: Devyl (devy@compuware.com)