DSP: store of 1/many

Author: osieman@gmail.com (osie_osie)

Hi All

My problem is that the foreign key of a painted entity is not inheriting the parent values which are set in the write trigger.


I have painted a 1/many.. autogenerated by 'copy as html'

In the presave trigger I default 0 as the value of the PK for both entities

In the write trigger of the parent I set the PK using 'sql select max(PK_NO) +1' .


The result is that the child entity picks up the parent value after issuing an error in the write trigger as the related field is 0 before the write command.

The only way to resolve the problem is by explicitely setting the inherited field with the parent value... which is normally a big no-no


Any help will be much appreciated







  1. Hi osie,

    I'm not an expert on web coding inside of uniface,

    but I think you have to define if input/output are transferred between server and client next to "public web"

    Perhaps this is not set?

    Success, Uli

    Hope you have no problems with the weather, we face heavy storms here in Regensburg in the afternoon

    Author: ulrich-merkel (ulrichmerkel@web.de)
  2. Osie, have you tried setting the parent key in the post load occurrence trigger of the SSV?

    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  3. ... a nogo as long as you are under the management/control of the structure editor.

    So foreign key transfer may not wotk the same way as it happened in C/S

    have you set the syntax of the PK fields to len(0-0) to avoid validation problems ??

    Another option may be invoking a javascript entry for the FK-transfer

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

    Firstly thanks for the interest...

    Uli: As far as I know the scope is for security reasons and by not having a scope means 'all'.  So for my preliminary development phase I am working without them.  Also, the setting of the pk field is happening on the server and so I do not think it is necessary to talk to the front end.

    I agree that maybe it is okay to manually set the pk fields for web but firstly it would be really bad to have to do all that work that uniface should be doing.  I am sure with uniface's relational integrity it should be working.. I am just missing something.

    I guess Regensburg would be raining ;-) 

    Actually here is horrible and in a few days I will drive to UK.  Probably even worse.


    I tried to put it in the post load trigger of the enitity but that did not help.. the same result.  Also, that trigger did not fire immediately before the write trigger to made sure it really is a unique pk. 






    Author: osie_osie (osieman@gmail.com)
  5. Good point. We use a counter table rather than sql max to set the ID, so it would work here.

    It would all be fixed by Uniface responding to my wish for support for automatic identifier and/or GUID columns.

    Author: Iain Sharp (i.sharp@pcisystems.co.uk)
  6. As all this DSP stuff is new to every one... is there not a forum DSP contact to get us all through the intial basics.

    Shared knowledge builds empires and I would like to think that one day web development in uniface will have a larger knowledge base.


    I can only assume that after 1 year of DSP's being developed that a 1/many relationship has alread been tried and tested.




    Author: osie_osie (osieman@gmail.com)
  7. Hi Osie

    For me scope serves more performance, and even software architecture, than security. The fact that you define a scope block and omit the input or the output (or both if your DSP is just an activator for another DSP, or a service) can drasticaly change the may you way organize DSPs. In fact, I think the scope theory and practise would need its own forum :)

    I'm out of subject, but it's important : the main goal of scope is not for security reason.

    Author: richard.gill (richard.gill@agfa.com)
  8. Cheers Richard

    My reason for not using scope was to remove another level of unexpected errors as I have not really undersood the in's and out's of scope.  I have it in, in places where I have copied code and it works.  For code I am less sure of, I found it all still works without the scope.  If I was to add a scope that I did not fully understand it may cause errors that I could not explain. 

    I realised it was possible to leave out the scope when I wanted to inclulde 2 operations from the same DSP; it is not possible to do that.

    Anyway, the reality is that scope is very important and we could do with a forum/scope master to guide us.


    How is your DSP development going... have you managed to take a medium complexity c/s frm and make it work using DSP?

    All was going well for me until I realised the OGF trigger does not exist anymore :-)


    Any direction pointers on what to do if a foreign key is not being populated by the parent?




    Author: osie_osie (osieman@gmail.com)
  9. How is your DSP development going... have you managed to take a medium complexity c/s frm and make it work using DSP?

    Well, we started making a toolbox, then creating DSP from scratch, but reusing existing FRM code. We later realized it was a bad idea, and the the best solution (at least for our porting project) was to create clean and lean code in DSP, making use of existing business services, and creating new ones for new access types or for a simple adaptation of existing services. Uniface makes RIA being easy, but a client/server model can't be reused as is.

    Another important thing we discovered is : you should very well understand how DSP / RIA works in Uniface, how (and what) data is transfered (that includes scope) to make good RIA real application (not a simple demo). I guess we could have gained 1 month/resource with a well apprehension of inner concepts (we discovered alone).

    Author: richard.gill (richard.gill@agfa.com)
  10. Well ... I have had a really good answer from Cpw, quick response and concise.  The conclusion is to either manually fill the foreign key (as I mentioned above) or use entity services. 

    It is looking like converting a frm to a dsp is not as easy as it seems.  CS solutions dont seem to work in a web world, and another perspective is needed. 

    I have many situation where I had emulated my CS frm to build a DSP and things dont quite work 100%.




    Author: osie_osie (osieman@gmail.com)
  11. Re: the scope command.

    Is there some way to see what is transfered depending on how the scope is coded?

    Also, Is there some way of predicting what will be in $webinfo("input") after a webload command.

    Author: osie_osie (osieman@gmail.com)
  12. .. $webinfo("input") ... predict? ... erhmm ... perhaps(look at the post/get request or even the Line in the browser). but you could try to "putmess" it in the GetState and after the Webload :)

    Author: -GHAN- (hansen@ahp-gmbh.de)
  13. hmm .. what am i trying to say

    I can see $webinfo in the debugger... I can also see the values of fields and the $occmod in the debugger.  These get filled after the webload

    What I seem to be missing.. is the bit inbetween.... are there client side variables that let me know what affect webload will have on $webinfo.

    what variable/field checking can I do in the preload occ.

    Author: osie_osie (osieman@gmail.com)