Disclaimer: This blog post was created with the assistance of an AI to help explain technical concepts in a clear and simple way.
Hello, Uniface developers! π If you've ever needed to programmatically clean up or manage your compiled application objects, you might have stumbled upon the $ude function. Today, we're going to take a closer look at a specific and very useful operation: $ude("delete").
Let's dive in and make it super simple to understand!
What is $ude("delete")? π€
In the world of Uniface, $ude is a powerful ProcScript function that lets you interact with the Uniface Development Environment. The "delete" operation specifically allows you to delete compiled runtime objects (like services, forms, and reports), symbol tables, or script listings directly from your code.
Think of it as a way to tell your application: "Hey, go and remove this compiled file from our deployment path (the $RSO path) for me."
The Basic Syntax βοΈ
The structure of the function looks a bit intimidating at first, but it's quite logical. Here it is:
vResult = $ude("delete", "Type;ResourceType", ResourceName, "", {OptionList})
Let's break it down:
- "delete": This tells Uniface the action we want to perform. Easy enough!
- "Type;ResourceType": This is a two-part string.
-
Type: Specifies what kind of information you're deleting. This is oftenresources_outputfor compiled objects. -
ResourceType: Describes the specific type of object, likecomponent,service, orform.
-
- ResourceName: The actual name of the object you want to delete (e.g., "MY_COOL_SERVICE").
- OptionList: Sometimes, Uniface needs more information, especially for global objects that belong to a specific library or language. This is where you provide those extra details.
Let's See an Example! π»
The best way to learn is with an example. Imagine you want to delete a compiled service named "MY_SVC". Here's how you'd do it:
vResult = $ude("delete", "resources_output;component;service", "MY_SVC")
Hereβs whatβs happening in that line:
- We are telling Uniface to delete...
- ...a compiled runtime object (
resources_output) which is acomponentof the typeservice... - ...and its name is "MY_SVC".
The result of the operation will be stored in the vResult variable.
What Do the Return Values Mean? β β
After you run the function, the vResult variable will tell you if it worked. This is super important for error handling!
-
1: Success! The object was deleted. π -
0: The object was not found. Maybe there was a typo in the name or it was already deleted? π€·ββοΈ -
<0: An error occurred. Something went wrong. To find out what, you should check the special ProcScript variables$procerrorand$procerrorcontextfor more details. π΅οΈββοΈ
Handling Global Objects with Options
What if the object you want to delete is a global menu that exists in a specific library and language? This is where the OptionList comes in. For example, to delete a German menu from your common library, your options might look like this:
vOptions = "library=COMMON_LIB;language=DEU"
vResult = $ude("delete", "resources_output;menu", "MAIN_MENU", "", vOptions)
This tells Uniface exactly which version of "MAIN_MENU" to delete.
Conclusion
And that's it! The $ude("delete") function is a straightforward tool for managing your application's compiled resources on the fly. It's great for cleanup tasks or dynamic deployment scenarios.
Happy coding! β¨
Top comments (0)