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

Bugs, Issues and Errors: $fieldname return PROCERR[<UPROCERR_FIELD>]

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

18 replies

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

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

what about the following?

in each field level trigger, cache $fieldname into v_fieldname (or $fieldname$) immediately

and use the variable afterwards instead of $fieldname


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

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

Yes, a global proc may be easier to "correct" the problem.
In the beginning of code I add a

v_fieldname = $fieldname

and after I test the local variabile instead of $fieldname, but it is possible, and this is a real case, that before a global proc I have other code with a setocc instruction inside, for example to control something, that make a $fieldname in error.

 

Marco


Author: Marco (marco.aquino@dedalus.eu)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:40 AM UTC

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

If it's in global proc then something like what Uli said would work. v_fieldname = $fieldname call lf_proc if(@v_fieldname="") return -1 endif return 0


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:40 AM UTC

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

the 9.4.R123 documentation is not too clear but ....

 

$fieldname returns:

  • Name of the current field if Field is not specified. If there is no current field (that is, if the last node of the active path is not a field), $fieldname sets $procerror to -1101.
  • Name of the field, if Field is specified and the field is present in the component.

If an error occurs $procerror contains a negative value that identifies the exact error.

 

... may say there is not always a target for $fieldname (put it as a watch in the debugger and see what happens)

In the old days, it was said there is no $fieldname possible in entity triggers.

 

And because @$fieldname directly uses the pointer, this is there it may cause the mess.

 

In your global procs, it may be enough to assign $fieldname to a dummy and check procerror afterwards before you use @$fieldname


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

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

The Iain's suggestion is very powerful, but it solves only a problem on field trigger.

In my example I show the code to generate error, but in my application the code is in a global proc and is used on many fields and the suggestion doesn't work.

Marco

 


Author: Marco (marco.aquino@dedalus.eu)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:40 AM UTC

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

Hi marco,

we encountered similar things when the "active path" is touched in the middle of a proc code.

Looks like performing entity-based-commands will extinguish the $fieldname pointer

 

Iain's suggestion using <$fieldname> precompiler constant has a lot of benefits:

- directly bound during compile (will speed up processing)

- works on "control" fields as well where $fieldname in not the name of the field activating the DTLF

 


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

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

Quick solution,
Replace @$fieldname with <$fieldname>, this hard codes the field name in at the time of compilation, and is therefore 'proof' against this issue.

We have been wholesale replacing $fieldname with <$fieldname> in all the detail etc triggers, and it certainly makes life less fraught.


Author: Iain Sharp (i.sharp@pcisystems.co.uk)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:40 AM UTC

$fieldname return PROCERR[<UPROCERR_FIELD>]

Author: marco.aquino@dedalus.eu (Marco)

Hi,
I found this error that in U8 did not appear.
The value of $fieldname return PROCERR[<UPROCERR_FIELD>] instead of name of field.
This appear when a setocc on other entities is performed.
Then if a new test on it like if (@ $ fieldname! = "") or assignment @$fieldname=$$VAR crashes Uniface.

Example like this

Detail trigger on a field:

call lf_proc
if (@$fieldname="")
   return -1
end if
return 0

 

the entry proc:

entry lf_proc
   setocc "ent",1
   while($status > 0)
      ...something...
   endwhile
end

The $fieldname change value  after a setocc instruction and the uniface crashes on "if" statement or at the end of trigger if I used an assignment.

 

Windows XP or Windows server 2003 R2 32bit
Uniface version 9.4.0.1 R117 or R124 also

 

Marco

 

I like both solutions.

I'll be consider what is the best for me.

Marco


Author: Marco (marco.aquino@dedalus.eu)