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

FYI   The header buttons in the grid are a kind of labels with extended triggers attached to them. You do not draw them in the graphical form painter and so when you click them the active path in UNIFACE does not change. If the active path is not changing the valuechange trigger will not be fired not will there any focus trigger fired. Although this is the UNIFACE behavior it is cumbersome to work with in this example. I think that you should contact UNIFACE support to see whether they can report a bug for this. Succes Jasper


Author: Jasper (jasper.de.keijzer@compuware.com)
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 Zdeněk It seems, that the group-header behaves like a control-comand-button. And with control-buttons, there is no verfication at all. But there is maybe a workaround: Just use the DEFORMAT-trigger. This one will be fired every time a user leaves the field, no matter in which way (except Dr.Watson&Co regards Ingo


Author: istiller (i2stiller@gmx.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

sochaz said In other words... we do not want to perform a sort every time FGF - I hope this is obvious. With User Key we do both, as I have mentioned earlier... if validation passed we clear the variable and sort, if validation failed we clear the variable and do nothing.

Hi again, i checked my notes and found that I just forgot that in the ecosystem I used there was a standard routine in every validation error trigger and one of the responsibilities of that routine was to empty the "process_next" information. which is, in your case, the sort which will be emptied in the UserKey trigger. Good Night from Frankfurt/Germany, Uli


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

Apologies for my earlier error.  I think this would fire the Validate Field trigger but it would depend what you were doing in that trigger whether it would get back to complete the sort.  With a simple calculation  and field assignment in the Validate Field it works fine.   trigger ColumnHeader_LClicked params string fieldName: in numeric shiftKey: in endparams validateocc sort $entname fieldname $prompt=fieldName Validateocc would, of course, fire any other outstanding occurrence level validation which might be an unwelcome side effect. Dave


Author: None (None)
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

Sorry, ignore my last - missed my mistake.   Dave


Author: None (None)
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

I haven't had time to investigate - particularly the key validation - but surely simple field validation could be completed with trigger ColumnHeader_LClicked params string fieldName: in numeric shiftKey: in endparams if ($fieldvalidation(fieldName)) validatefield fieldName endif sort $entname fieldname That would fire the Validate Field trigger.  If this is an editbox, I would try to avoid use of Value Changed: That trigger is, I believe, more suited to use with widgets such as dropdownlists and radio groups.  If the field is validating, then the value has changed in some way in any event, has it not? Validatekey - might that work too? As I say, I haven't had the time to test.  I will try and do so later.  Just my first thought.   Dave


Author: None (None)
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 Uli, you are (partly) right. Please consider the situation, when validation fails... prompt is not set and no sorting is done. Now user corrects the error and click the field (with the "sorting" code in FGF trigger)... now the sorting is done, which is not what we need. In other words... we do not want to perform a sort every time FGF - I hope this is obvious. With User Key we do both, as I have mentioned earlier... if validation passed we clear the variable and sort, if validation failed we clear the variable and do nothing. There is no way for user to activate the user key (with that "sorting code"). 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

Hi Zdeněk, If you put in a $prompt which is not followed due to validation problems, I assuemd your user will get the necessary validation information which is sufficient in this case. And therefore is no need for further warnings etc. If FGF is reached anything is fine and it's time to do your sort.


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 Zdeněk, FGF may be a better way to implement as the ^userkey you mentioned: The userkey trigger is a property of the component (sacttered ...) The FGF can be implemented with the modeled field, so all you have to do is to paint entity and field.


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

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

Hi Theo, What exactly do you consider a bug? The "leave triggers" (mainly Leave Field) is not fired upon several situations. For example if user types anything and then invoke a retrieve... even validations are not fired (mostly visible on fields of datatype "date"). I'm not sure if support can fix this as a bug. I'm afraid they consider this a behavior change, but I could try to report it. It would even help if we could fire these triggers explicitly (in a similar way as validation can be fired...) but we need to fire *all* triggers, including the "Leave Field" with $fieldendmod set  - but I'm afraid this is definitely request feature (for a wishlist?). From user point of view this trigger should be fired prior to do anything defined in ColumnHeader_LClicked trigger. But the same problem applies to many other actions, for example operations called via menu (pop-up menu or drop-down menu). This is very tricky in Uniface (everything is controlled by the structure editor, but we can't control the structure editor). Zdeněk


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