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.
Original Message:
Sent: 09-30-2024 05:00
From: Robert Cooper
Subject: Adding a variable to every component in a U10 IDF
Hi Iain,
Sounds like a great plan, I'll try it out.
Thanks
Rob
------------------------------
Robert Cooper
Sanderson Multi-Channel Solutions Ltd
Original Message:
Sent: 09-30-2024 04:43
From: Iain Sharp
Subject: Adding a variable to every component in a U10 IDF
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
Original Message:
Sent: 09-30-2024 04:11
From: Osman Shariff
Subject: Adding a variable to every component in a U10 IDF
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
Original Message:
Sent: 09-30-2024 03:43
From: Robert Cooper
Subject: Adding a variable to every component in a U10 IDF
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
Original Message:
Sent: 09-30-2024 03:29
From: Osman Shariff
Subject: Adding a variable to every component in a U10 IDF
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
Original Message:
Sent: 09-28-2024 13:06
From: Robert Cooper
Subject: Adding a variable to every component in a U10 IDF
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
------------------------------