Skip to main content
Question

Uniface Web - current occurance

  • January 9, 2026
  • 8 replies
  • 34 views

OsmanShariff
Forum|alt.badge.img+3

I would like to know if it is possible to get the current occurance using an ‘entity’ webtrigger.

 

I can do this at field trigger level.  I can go up to a parent level to the occurance(as documented).

 

When in a webtrigger at entity level, the ‘this’ is the entity and not the occurance.  

There is no possibilty to go down to a child level(occurance).

I can get all occurances for the entity or the nth occurance at entity trigger level.

But there seems to be no property to get the current occurance at entity level.  I would have imagined it would be a basic need.

 

What would be the solution to get the current occurance of an entity without using field level triggers.

 

8 replies

Juliano Anoar Haoach Garcia
Forum|alt.badge.img+1

Do you try this?

 

webtrigger onfocus
scope
output
endscope
javascript

 

        var vInstance = uniface.getInstance("MUSICLIST");
        if (vInstance != null) {
         var vEntity = vInstance.getEntity("ITEMS.MUSICSHOP");
         if (vEntity != null) {
         var vOccs = vEntity.getOccurrences();
         for (var i = 0; i < vOccs.length; i++) {
            doSomethingWithOccurrence(vOccs[i]);
         }
         var vOcc = vEntity.getOccurrence(4);
         if (vOcc) {
         alert (vOcc + " has status " + vOcc.getStatus());
         }
         }
        }

 

endjavascript
end


Juliano Anoar Haoach Garcia
Forum|alt.badge.img+1

OsmanShariff
Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • January 9, 2026

Hi Juliano

 

This was what I said above.

I can get all occurances for the entity or the nth occurance at entity trigger level.

 

all occurances → getOccurrences()

nth occurance → getOccurrence(4)

 

but there is no vEntity.getCurocc();


Juliano Anoar Haoach Garcia
Forum|alt.badge.img+1
var vOcc = vEntity.getOccurrence(4);

OsmanShariff
Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • January 9, 2026

In this case it is just the 4th occurance.  It is not the occurance that I double clicked on.


Juliano Anoar Haoach Garcia
Forum|alt.badge.img+1

Maybe every time you enter an occurrence, set some HIDE field with the occurrence ID.


OsmanShariff
Forum|alt.badge.img+3
  • Author
  • Participating Frequently
  • January 9, 2026

The occurances are via a retrieve but uniface does already give them a unique id 4,5,6 corresponding to the $curocc.

uocc:{identifier}.4

uocc:{identifier}.5

uocc:{identifier}.6

 

But to get the occurance, I decide to double click, is not possible at the entity level web trigger; only from field level via this.getParent().getIndex() at occurance level.


Iain Sharp
Forum|alt.badge.img+5
  • Inspiring
  • January 12, 2026

Just for fun I can tell you that the ID does not (Always) correspond to the $curocc, assuming it did messed with my code.