Script: Copy SQL folder

Duplicate a SQL folder incl. Queries

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 27.09.2016
Updated: 10.10.2024 | Replaces Python script: Also copies the list controller name.

Copies the current SQL folder including all queries and pastes it into a destination folder. The destination folder is specified by the ID, which can be found on the destination folder by right clicking > Property > Internal ID.

The list settings are not copied. If you also want to apply them, use the Copy List Settings script.

Version

Version description Scripting
6.6 Script in Python. Also copies the list controller name. CopySQLOrdner.py

Script text

#---Description: Copy SQL folder
#   Classes: Entry
#   ObjectScript: No
#   ContainerScript: Yes
#   EventType: None
#---The script copies the current folder as a subfolder
# of another folder.
#   The new pairing folder must be specified via the ID.
# The ID can be found in the folder with the right mouse button > Property.
#---11.11.2011, cp: created.
#---27.09.2016, sr: msgbox by vertec.msgbox and inputbox
#   replaced by vertec.inputbox.
#---15.06.2018, sth: Script translated into Python. Prerequisite: Vertec 6.2
#---19.10.2023, sth: Also copies the field list controller from Vertec 6.6

def main(folder):
    parentord = None
    if not ordner.eval('oclisKindOf(Sqlfolder)'):
        vtcapp.msgbox('You can only execute this script on a SQL folder.')
    else:
        # Determine New parent folder
        parentid = vtcapp.inputbox('Vertec’,'Specify the ID of the new parent folder.','')
        if parentid:
            try:
                parentord = vtcapp.getobjectbyid(parentid)
            except:
                vtcapp.msgbox('No folder with this ID was found. The copy operation was aborted.')
            else:
                try:
                    newordner = vtcapp.createobject(“SqlFolder)
                    newordner.parentordner = parentord
                    # copy all members
                    newordner.allowShowAll = ordner.allowShowAll
                    newordner.orderClause = ordner.orderClause
                    newordner.showDialog = folder.showDialog
                    newordner.whereClause = ordner.whereClause
                    newordner.classname = ordner.classname
                    newordner.creatorTypes = ordner.creatorTypes
                    newordner.dialogParamsInitialized = folder.dialogParamsInitialized
                    newordner.expression = ordner.expression
                    newordner.searchConfiguration = ordner.searchConfiguration
                    newfolder.name = folder.name
                    newordner.tabsProClass = folder.tabsProClass
                    newordner.idx = ordner.idx
                    newordner.persistentIcon = folder.persistentIcon
                    newordner.remarking = ordner.remarking
                    newordner.controllerclassname = ordner.controllerclassname
                except Exception as e:
                    vtcapp.msgbox('There was a problem creating the new folder. The copy operation was aborted.\nThe error is: %s’ % str(e))

main(argobject)
Bitte wählen Sie Ihren Standort