Uniface User Forum

 View Only
  • 1.  Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 9 days ago

    Hi,

    Is it possible (without changing the IDF repository) to add a new local variable to every component in a U10 IDF?

    When Uniface components are deployed in UAR files, it seems impossible to find out which UAR file the component was actually loaded from.

    In our application we have projects, in the idf each project version is identified by a project suffix e.g. a form names TEST may have 10 variants like TEST_P0001, TEST_P0002 ...

    Each of these forms will be deployed in a project UAR file named after the project P0001.uar or P0891.uar but will be named TEST.FRM in each uar file the only way to find out the variant is to activate the form as query $componentname or display the component name in the title bar or any other way you can think of, for services that will not work.

    I want to inject a local variable in every component 

    string VERSION_<the comp version>

    then in query form, run cod as below were "P_comp  would be a param in

    newinstance P_comp,"getversion" 

    $1 = $componentinfo("getversion","VARIABLES")

    The variables will have the list of local variables including the injected VERSION_P0001

    I could inject the code directly in SQL or export the components, inject the code into the XML export file and reimport, both these are tricky and problematic. 

    Is there a safer way to do this?

    Can the UAR where the form is run from be identified?

    Thanks for reading if you got this far :)

    Rob



    ------------------------------
    Robert Cooper
    Sanderson Multi-Channel Solutions Ltd
    ------------------------------


  • 2.  RE: Adding a variable to every component in a U10 IDF

    Posted 7 days ago

    Hi Robert


    I'm not 100% sure want you want to do, but "to inject" a variable into a compiled component is a no go.
    The "variables" are compiled and stored with a kind of P-Code into the whole compiled from.


    What may possible (I'm mot sure) ist to add a variable in the IDF (the source code of the component) like "VERSION_NNNN", after compiling (without ZIP) one can search for the string "VERSION_NNNN" in the compiled P-Code and replace it with "VERSION_1234". But be carefull, do not change the length.

    But why not change the version info in the repository?
    Is the "problem" that it is only clear which version it is after compiling and at the moment of creating the UAR file?
    A solution would be a little (UnifAce) program to search for "VERSION_XXXX" (short before creating the UAR)  in the variable declaration section of a compont and then replace this variable name, and the compile it.
    Or another solution would be to store the compile-datetime in a variable of the component. (either by a little UnifAce programm or a "manipulated" view of the source code). Then create a new small table (which is also delivered) that contains the dates on which the UAR files are created. Or you can rely on the dates of the UAR creation.
    Then you can compare the variable with the compile date against the list of UAR dates and know in which the component was (is not 100% watertight, but an approach)

    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 3.  RE: Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 7 days ago

    Hi Ingo,

    The problem that I need to resolve is to help us know which IDE component is actually running.

    In the IDF we could have the same component with 10 project changes eg TEST_P0001, TEST_P0002 .... TEST_P0010

    each of these are in a separate UAR file, unless you run the component the you don't know which one is actually running as not all systems have the same version running.

    The local variable needs to be compiled into the component but only as an easy way to instantiate it and get the list of variable to fine the version variable.

    We need a little manual or Admin work by the devs as possible, the just have to change the variable name to the project it was copied to or created for.

    Thanks for you suggestions.

    Rob 



    ------------------------------
    Robert Cooper
    Sanderson Multi-Channel Solutions Ltd
    ------------------------------



  • 4.  RE: Adding a variable to every component in a U10 IDF

    Posted 7 days ago

    Some immediate thoughts:- 

    1)

    Why not change the repository of a backup..... 

    create a backup of DICT....

    update uform

    comile to uar

    2)  Identical to option 1, export to xml, then modify the xml, compile to uar

    3) Another idea, if you have a central point for your activate statement... change that to incorporate a version in the $instancename



    ------------------------------
    Osman Shariff
    ------------------------------



  • 5.  RE: Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 7 days ago

    Hi Osman,

    I have played with the uform update, our IDE is using overflow tables so an update is very tricky

    Rob



    ------------------------------
    Robert Cooper
    Sanderson Multi-Channel Solutions Ltd
    ------------------------------



  • 6.  RE: Adding a variable to every component in a U10 IDF

    Posted 7 days ago

    Hi Robert, 

    Uform will work fine at the beginning of the EXEC trigger

    You could also add code like #defines Version = <InjectVersionHere > to every component and use sql to update uform and oufrom

    or, you could use option 2 and replace the xml (so you are not reliant on overflow tables)

    but, all suggestions would be to change a copy of the source



    ------------------------------
    Osman Shariff
    ------------------------------



  • 7.  RE: Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 7 days ago

    If this is to be used occasionally (e.g. for debugging or occasional error reporting) then there is another approach. 

    You could use $assignments("RESOURCES"), (which doesn't appear to be documented) to get the list of uar files (and folders) deployed. 

    A loop through this list, looking for $fileexists (you'd have to determine the file type from the componenttype and add the folder and suffix) which stopped at the first match would give you the file name of the UAR that file was loaded from. 

    Slower than having it compiled in, but 0 developer maintenance. 

    Regards, 

    Iain



    ------------------------------
    Iain Sharp
    Head of Technical Services
    Pci Systems Ltd
    Sheffield GB
    ------------------------------



  • 8.  RE: Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 7 days ago

    Hi Iain,

    Sounds like a great plan, I'll try it out.

    Thanks

    Rob



    ------------------------------
    Robert Cooper
    Sanderson Multi-Channel Solutions Ltd
    ------------------------------



  • 9.  RE: Adding a variable to every component in a U10 IDF

    PARTNER
    Posted 7 days ago
      |   view attached

    Hi Rob,

    I had the same need a while back but for a different reason. I have NOT used it since I migrated all my projects to U10 so the usual disclaimers apply. It was a very rough but simple way to do what I believe you want so feel free to kick it around and modify it to fit your needs. You can see where I was very cautious at using it since I tested it in small batches. Once I saw the results, I felt comfortable running it in any project. I've not had the need to ever use this function again. I do agree with the other people on this thread about using alternate solutions for what you are looking to do, but it's hard to know when you will need something like this so I'll share what I have since I have gotten some ideas from this community and you have to give back if you're going to grow the base.



    ------------------------------
    Larry Adkins
    Proware
    Cincinnati OH US
    ------------------------------

    Attachment(s)

    xml
    cpt_add_variable.xml   66 KB 1 version


  • 10.  RE: Adding a variable to every component in a U10 IDF

    Posted 5 days ago

    Hi Robert,

    why do you want to inject a Variable?

    Why not a operation OP_Get_Version?

    You just have to inject only once a "#include MY_LIBRARY:MY_OPERATION" into the Script Container of each Form/Service/Report.

    In MY_LIBRARY:MY_OPERATION you can write a operation like this:

    operation OP_Get_Version
    params
    string P_VERSION : out
    endparams
    P_VERSION = "1234"
    end

    You can now change the injected Text as you like.

    You only have to change the Text in Table UINC per SQL:

    update UINC

    set ucomment = '<unimeta><UTEXT>operation OP_Get_Version

    params
    string P_VERSION : out
    endparams
    P_VERSION = "1234"
    end
    </UTEXT>
    </unimeta>' 
    where UVAR = 'MY_LIBRARY' and ULABEL = 'MY_OPERATION'

    Kind regards

    Norbert



    ------------------------------
    Norbert Lauterbach
    Infraserv Gmbh & Co. Höchst Kg
    Frankfurt DE
    ------------------------------



  • 11.  RE: Adding a variable to every component in a U10 IDF

    Posted 3 days ago

    Hi Norbert


    We do have two operations (defined per include)


    OPERATION INSTANCEPROPERTIES_GET
      params
        $INSTANCEPROPERTIES$:OUT
        string v_PARA:INOUT
      endparams
    END ; INSTANCEPROPERTIES_GET


    OPERATION INSTANCEPROPERTIES_SET
      params
        $INSTANCEPROPERTIES$:IN
        string v_PARA:INOUT
      endparams
    END ; INSTANCEPROPERTIES_SET

    And in every component there is a component local variable $INSTANCEPROPERTIES$
    In addition, the INIT operation is integrated via include, which, among a thousand other things, also responsible for filling this variable

    As you can slo write to this variable, you can store every time component depending information at runtime like "Surface init is done"  or "user rights"
    The content then looks like this :-)

    Ingo

    CPT_NAM=PZ2000E·;
    __DATETIME__=20240916142651·;
    PF_VERSION=*DTF·;
    VARIATION=FAV_LIB·;
    ORG_RUNMODE=0·;
    ORG_EDITMODE=0·;
    ORG_FORMTITLE=PZ2000E: Zeichnungscheine (Übersicht)·;
    CONNECT_TYPE_SF=·;
    COMPONENT_TYPE=POP·;
    DTF_CC_COMPONENTTYPE=·;
    ORG_MODALITY=·;
    MODALITY=·;
    GOL=GENERAL=GPL=NAM=*VAL_IN·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_OUT·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*GDA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      CB=GPL=NAM=*TOPIC·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_IN·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_OUT·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA2·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*GDA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      OP_GET_CLL_HANDLE=GPL=NAM=CLL_HANDLE·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=H·!·!·!·;
          NAM=ENT_ID·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      OP_GET_OCC_HANDLE=GPL=NAM=OCC_HANDLE·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=H·!·!·!·;
          NAM=ENT_ID·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=OCC_NR·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=N·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      INIT=·!·;
      CLEANUP=·!·;
      INSTANCEPROPERTIES_GET=GPL=NAM=*PROPERTIES·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      INSTANCEPROPERTIES_SET=GPL=NAM=*PROPERTIES·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·;
    GEL=LP_EDIT=GPL=NAM=*VAL_IN·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_OUT·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      LP_NOTIFY=GPL=NAM=*VAL_IN·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_OUT·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·!·;
      LP_GET_INSTANCEINFO=GPL=NAM=*VAL_IN·!·!·!·!·;
            DIR=I·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*VAL_OUT·!·!·!·!·;
            DIR=O·!·!·!·!·;
            GPT=TYP=S·!·!·!·;
          NAM=*PARA·!·!·!·!·;
            DIR=B·!·!·!·!·;
            GPT=TYP=S·;
    PMS=T·;
    SYS_CMP_INI_VAL_IN=·;
    SYS_CMP_INI_PARA=·;
    WIN_UOBJ_BEG=108·;
    WIN_UOBJ_LAS=108·;
    WIN_UOBJ_CUR=108·;
    WIN_UOBJ_DIF=0·;
    WIN_UOBJ_MAX=10000·;
    WIN_GOBJ_BEG=200·;
    WIN_GOBJ_LAS=200·;
    WIN_GOBJ_CUR=200·;
    WIN_GOBJ_DIF=0·;
    WIN_GOBJ_MAX=10000·;
    IS_INIT_PROG=1·;
    RECHTE_DSP=SEAL·;
    ENTNAME_FOCUS=DZ2000·;
    ENT_PROPS_D_DZ2000=CLL_TYP=·!·;
      TBL_ID=DZ2000·!·;
      DBG_HIDE=F·!·;
      RCHK=T·!·;
      GES_FEM=GESELL_NR.DZ2000·!·;
      VBK_FEM=VBK.DZ2000·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=DSG_LOI_DAT.DZ2000·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DZ2000=·;
    ENT_PROPS_D_DG1000=CLL_TYP=·!·;
      TBL_ID=DG1000·!·;
      DBG_HIDE=F·!·;
      RCHK=F·!·;
      GES_FEM=GES_NR.DG1000·!·;
      VBK_FEM=·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DG1000=·;
    LAST_GES_NR=4711·;
    LAST_GES_ENT=DG1500·;
    ENT_PROPS_D_DG12001=CLL_TYP=·!·;
      TBL_ID=DG1200·!·;
      DBG_HIDE=F·!·;
      RCHK=F·!·;
      GES_FEM=GES_NR.DG12001·!·;
      VBK_FEM=·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DG12001=·;
    ENT_PROPS_D_DG1200=CLL_TYP=·!·;
      TBL_ID=DG1200·!·;
      DBG_HIDE=F·!·;
      RCHK=F·!·;
      GES_FEM=GES_NR.DG1200·!·;
      VBK_FEM=·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DG1200=·;
    ENT_PROPS_D_DG1500=CLL_TYP=·!·;
      TBL_ID=DG1500·!·;
      DBG_HIDE=F·!·;
      RCHK=F·!·;
      GES_FEM=GES_NR.DG1500·!·;
      VBK_FEM=·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DG1500=·;
    ENT_PROPS_D_DG0500=CLL_TYP=·!·;
      TBL_ID=DG0500·!·;
      DBG_HIDE=F·!·;
      RCHK=F·!·;
      GES_FEM=·!·;
      VBK_FEM=·!·;
      KLS_FEM=·!·;
      SHOW_LOI=·!·;
      LOI_FEM=DSG_LOI_DAT.DG0500·!·;
      ALWD_DISCARD=·!·;
      IS_BCKGRD=F·!·;
      INFO_TYP=PRGTBL·!·;
      RRF=USR·!·;
      RMF=USR·!·;
      RUF=USR·!·;
      RWF=USR·!·;
      RDF=USR·!·;
      RR=T·!·;
      RM=T·!·;
      RU=T·!·;
      RW=T·!·;
      RD=T·!·;
      RX=T·!·;
      RXF=USR·!·;
      LX=F·!·;
      LXF=TBL·!·;
      LR=F·!·;
      LRF=TBL·!·;
      LM=T·!·;
      LMF=TBL·!·;
      LU=T·!·;
      LUF=TBL·!·;
      LW=F·!·;
      LWF=TBL·!·;
      LD=T·!·;
      LDF=TBL·!·;
      PHY_LOG=P·!·;
      STEMPEL=T·;
    ENT_PROPS_P_DG0500=



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------