Uniface User Forum

 View Only
  • 1.  'Clearing' an inherited relationship from a subtype.

    PARTNER
    Posted 10-07-2021 07:40
    So, I recently came across an issue where we have the 'same' menu in three different languages, and the two 'specialised' languages had not been kept up to date. 
    I was trying to write a report component which compared usitem-usmenu with usitem_1-usmenu_1  (subtypes I created) where the first menu was language USA and the second one wasn't. 

    The usmenu_1 entity is automatically getting the relationship equivalent to usmenu (which includes the language), making it impossible to set a read trigger for where the languages are different. 
    I can't set up a relationship between usitem and usmenu_1 because it's a many to many relationship, in fact I can't set up the correct relationship between usmenu and usmenu_1, as the primary key needs an equivalent in both sides. 

    So, I could do this using a u_where clause if the usmenu_1 subtype was explicitly not related to usitem. Is there any way I can remove the relationship inheritance specifically. 

    Iain

    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield United Kingdom
    ------------------------------


  • 2.  RE: 'Clearing' an inherited relationship from a subtype.

    Posted 10-08-2021 07:50
    Hello  Iain,

    Have you tried to use  an intermediate entity?

    Richard

    ------------------------------
    Richard de Vries
    Sogeti Nederland B.V.
    Netherlands
    ------------------------------



  • 3.  RE: 'Clearing' an inherited relationship from a subtype.

    PARTNER
    Posted 10-08-2021 09:14

    Well, I'm trying to look at stuff managed by uniface in the dict model, so I'd have to run a thing that built the intermediate entity somehow. I was looking to write a report to basically show "this is where the same menu in a non base language differs from the base menu" 
     
    I am aware that the canonical many to many relationship has an intermediate, but I'm looking at this relationship for reporting rather than database management purposes. Normally, where a relationship did not exist, I could put a job-specific u_where clause in the entity to get the report component to read the correct one, but I can't do it here, because it appears that the inherited relationship from the parent entity is in place, and enforces the language being the same, when I want it to be different. 

    I have a menu called "SYSTEM", in a library called "GLOBAL" in three languages, "USA","AME","SIN". 
    I want to paint (from the dict model) USITEM and USMENU twice, and have the system retrieve the outer one based on the language being USA, and then a related one based on umenu, uvar & useq being the same, but ulan being different. so I can then compare and contrast the title, predisplay and option triggers. 
    I can't do this in sql or crystal because the fields I want to play with are held in the ucomment database field, (and overflow table). 
    I can't do it in uniface (without creating this table I'd have to maintain myself) because I can't detach the relationships. 

    Could I paint a dummy table inside the outer usmenu, and then put the inner usmenu inside it, would that break the relationship and (basically give me path to XXXX not found?)

    Iain



    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield United Kingdom
    ------------------------------



  • 4.  RE: 'Clearing' an inherited relationship from a subtype.

    ROCKETEER
    Posted 10-08-2021 09:22
    Edited by David Akerman 10-08-2021 09:28
    Hi Iain,

    It might be worth trying to add a dummy intermediate entity in the component structure to break the relationship (I can't say if it would work off the top of my head without trying it, but theoretically it might). If not, i'd try the following:

    Duplicate the entity instead of creating a subtype, remove the relationship on the duplicate (they are defined on the many entity in Uniface 10) and map it to the original underlying database table in the assignment file. Modify u_where clauses as needed (e.g. if removing the relationship on the supertype you might need to code it in read condition so the parent entity behaves as before, then override the read conditions in any subtypes you create based on that parent)

    Kind Regards,
    ------------------------------
    David Akerman
    Rocket Software (UK)