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

Uniface 9: logging a form whenever it is activated or acessed.

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

19 replies

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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Hi lalit, if you follow Theo's suggestion, there are some common pitfalls when dealing with the metadictionary: do not forget to put a "write" in the WRITE-trigger of UFORM (the metadictionary is delivered with empty write and delete triggers because it's easy to mess up the complete repository) and be sure that you commit the database changes after your store.


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Wrong abstraction level Lalit. You are changing the definition of the UFORM table. You chould be changing the content of the rows of the UFORM table. MAKE VERY SURE THAT YOU HAVE A BACKUP !!! You are not an experience Uniface developer and making changes directly of the DICT tabls is DANGEROUS !!! So go back to the original definition of the DICT model. Now go to the Form editor and create a new Form. Let's call it ADDLOG. On that Form paint the entity UFORM of the DICT model. Paint the fields that you need, say ULABEL, UTRANSACT and SFUNC. UTRANSACT has the component type (Form, Service, Report ect) Compile and retrieve. Now you see the data that you may want to change. It is up to you to add code to this simple Form ADDLOG that will automatically add some code to the start of the SFUNC field. MAKE VERY SURE THAT YOU HAVE A BACKUP !!! You are not an experience Uniface developer and making changes directly of the DICT tabls is DANGEROUS !!! Theo


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Hi lalit, looks like you completely misunderstood the concept how uniface works. It's not the model, but the data in the repository (the value of the field SFUNC) which needs to be amended. That's what you do if you open the component for editing and add your operation init into the operations trigger of the component. It makes no sense at all to put this code in any trigger of the field in the data model. the "operations" keyword is restricted to only a couple of triggers, all the other should create error messages. As long as you do not paint the entity (and the field) on a form, the code will not be inherited.


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Step 1 : Open MODEL DICT ->Go to Entity UFORM -> Go to SFUNC -> go to field SFUNC Step 2 : Added below code in all SFUNC field triggers (Value changed,Validate field,start modifiction..etc) operation init putmess "hello 1" end Step 4 : Analyze model Step 4 : Opened a sample form abc.frm ,compiled it What I undesrstand is code from SFUNC triggers should be present in operation trigger of abc.frm after compilation. Or what I am expecting is not the way it will work?


Author: lalitpct (lalitpct@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:32 AM UTC

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Hi lalit, looks like your implementation to append to the SFUNC field was not correct. As a standard, the metadictionary is delivered with an empty write trigger; so nothing is written to the database. Sometimes, there is a store with a commit missing or not executed which cause a rollback when you close your application. I do not know what you mean with: (code in all triggers) was not added automatically in sample form after compilation. can you give me some more hints what you have done to expect some "automatically added code after compilation"?


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Setting $ioprint to 512 will put a line in the log files for each activate (and no more), then you'd need to clear out the log files by parsing them for information on the way out of the application and then deleting them. Use %p to get a log file for each session. Changing things using the DICT model etc will require a recompile of all the forms in the system, but gives you much more control over what you want to log and when.


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Actully logs cannot be activated as these are production server , we have space limitation as activating logs will create heavy log files. I have acess to DICT model etc , if there is something i can modify and apply the changes there ..it will solve the issue.


Author: lalitpct (lalitpct@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:32 AM UTC

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

$ioprint=512 causes all activates to be logged in the uniface log files, You'd then need some form of cleanup on leaving the application which read the log file and filled the data file with this. But getting the actual time out of the log file is problematic.


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

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Thanks Uli Difficult to compile means I cannot compile all of them and get it released in production , as this is running project. sorry for confusion. Hence I was looking for something where i can just modify some global stuff and then get it logged in some table.


Author: lalitpct (lalitpct@gmail.com)
Jan Cees Boogaard
Rocketeer
Nov 19, 2018 11:32 AM UTC

logging a form whenever it is activated or acessed.

Author: lalitpct@gmail.com (lalitpct)

In our project we have lot of screens activated in ad hoc manner. I want to log them in a table whenever they are acessd, Below is one example how it is activated. Is there any inbuilt functionality which can be used here , I cannot modify this at each and every place so some inbuilt functionality needs to be used $1 = @$fieldname activate "act_lu"

Hi lalit, perhaps the blog and the replies are interesting for you: http://unifaceinfo.com/why-you-should-clean-up-dead-code/ One option is the use of the proc tracing with a followed analysis of the very long files created this way. But this is in fact the only way which does not require changing the code in the components and recompile them. I'm puzzled when you say, "compiling all forms is difficult at present": do you not have the sources handy to just run a "IDF.exe /all" ?


Author: ulrich-merkel (ulrichmerkel@web.de)