Skip to main content
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Bugs, Issues and Errors: Tricky sorting and trigger activation

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

15 replies

Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

ulrich-merkel said Hi Zdeněk, have you tried to use the "Field gets Focus" Trigger instead of the Userkey Trigger?

 I'm not sure, how would the "Field Gets Focus" trigger help here? On which field/widget? If Leave Field pass the prompt is set to a field with NED,NPR and this FGF is fired. And if Leave Field fails the prompt remains on original field. But we need to solve both situations. Zdeněk


Author: sochaz (zdenek.socha@fullsys.cz)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

sochaz said It's a bit complicated and quite hard to globalize (the necessary proc code is scattered all around the component), but it solves the problem. Zdeněk Socha

Hi Zdeněk, have you tried to use the "Field gets Focus" Trigger instead of the Userkey Trigger?


Author: ulrich-merkel (ulrichmerkel@web.de)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

Hi Zdenek, Have you reported this bug to Support? Sounds like something that needs to be fixed. Theo


Author: Theo Neeskens (tneeskens@itblockz.nl)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

Yes, I'm in a form. And I need to activate all "leave triggers", that is Leave Field, Validate Field, Leave Modified Key and so on... that is what developer expects, but Uniface skips all those triggers. And there is no way to force structure editor to call them [explicitly]. In a meantime we have solved this problem. Instead of global proc for sorting, we place all information in a component variable, set prompt to a NPR,NED field (in a different entity) and call macro user key. In a user key trigger we check if the prompt is in the field, if yes, then we suppose all "leave triggers" (including validations) passed and then change prompt back and call the actual sorting. Otherwise (e.i. prompt is not in the expected field, which means leave field or validation did not passed), we clear the variable and do nothing. We use this workaround for several other things, not just sorting. This seems to work fine. It's a bit complicated and quite hard to globalize (the necessary proc code is scattered all around the component), but it solves the problem. Zdeněk Socha


Author: sochaz (zdenek.socha@fullsys.cz)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:41 AM UTC

Tricky sorting and trigger activation

Author: zdenek.socha@fullsys.cz (sochaz)

Hello, we're facing a problem with trigger activation and sorting occurrences in a grid. I'll try to describe the situation. Short description: - user enter data in a field, then clicks on a column header to sort the entity, then leaves the field... some triggers are never activated (e.g. ValueChanged) Detailed description:

  • user enters data in a field
  • user decides to sort occurrences - so he clicks on a column header - this activates extended trigger, which calls a global procedure
  • sort is performed, setocc to the same occurrence before sorting and prompt is set back to the original field
  • some triggers are not fired, for example ValueChanged, $fieldendmod is not set

This is quite a problem... in common situation, when user enters data in a field (which is part of the primary key), these triggers are activated: Value Changed, Validate Field, Leave Field (with $fieldendmod set), Leave Modified Key, Next Field But if user sorts data... nothing is activated, but only Extended trigger of the grid widget... and upon leaving field, only these triggers are activated: Validate Field, Leave Field (with $fieldendmod *not* set), Leave Modified Key. So, Value Changed and Leave Field (with $fieldendmod set) is *never* activated. There seems to be no workaround for this bug. We're facing this problem only with grid widget, because with no grid, there are "sorting buttons" upon entity, so if user clicks this "sorting button", all triggers are activated *before* sorting, that is Value Changed, Validate Field, Leave Field etc.... but with grid widget, sorting is done on column headers, and Uniface skips all triggers. Have anyone tried to solve this problem? It seems to be quite complicated, since $fieldendmod can't be set. And according ulibrary, this function is valid only in Leave Field trigger, so we can't use it in extended trigger to check it prior sorting... even though, user leaves the field, Uniface skip some triggers and never fire them. Zdeněk

Just fast thinking: I think you need "Value Changed" trigger to be fired... I suppose your grid is not taking the entire component space... What's about trapping user decision/needs into your grid Extended Trigger and executing real sorting outside your grid, after the "Value Changed"...just re-positioning user back into the grid after completing... You are in a FRM, right? Gianni


Author: gianni (gianni.sandigliano@unifacesolutions.com)