Script: Copy List Settings

Copies the list settings of folders, Linkcontainers, and resource planning views

Product line

Standard

|

Expert

Operating mode

CLOUD ABO

|

ON-PREMISES

Modules

Services & CRM

Budget & Phases

Purchases

Resource Planning

Business Intelligence

Created: 28.11.2005
Updated: 11.05.2023 | Takes into account dynamic columns and can also be executed on resource planning views.

Copies the list settings of a folder, Linkcontainer, or resource planning view to the current view.

It is important to pay careful attention to what is being carried over. If list settings are carried over to locations where they do not fit, Vertec can crash.

Therefore, we recommend that you do not register the script, but use it through the Script Editor.

You can also set list settings that you want to use for all lists of a class (e.g. all address lists) as default. See the article about the list settings – Save as default save.

Versions

Vertec version Special feature Version Scripting
From Vertec 6.6 Takes into account dynamic columns and can also be executed on resource planning views. CopyListSettings.py

Execute

Folders and Linkcontainers

The script must be executed on the folder/Linkcontainer that you want to get the list settings.

Select it and then open the Script Editor .

Run the script. A browser will appear where you can select the folder/Linkcontainer from which you want to copy the list settings.

Resource planning views

The list settings of tables in the Resource Planning is done as usual via the button Listeneinstellungen directly on the table.

However, the copying takes place on the definition of the resource planning view. These are under Einstellungen > Ressourcenplanung > Ressourcenplanungsansichten to find.

Open the resource planning view to which you want to carry over list settings, and then open the Script Editor and run the script.

A browser appears where you can select the resource planning view from which the list settings are to be copied.

Script text

# coding: windows-1252
#
#---Description: Copy list settings
#   Classes: Entry
#   CondExpression:
#   ObjectScript: No
#   ContainerScript: Yes
#   EventType: None
#   EventClass:
#   EventMembers:
#   ExtendedRights: N
#---Copies the list setting of another
# Folders in the current folder. Must be on the folder
# to get the list settings.
# The folder from which the list settings are applied to be adopted
#   must be specified via the ID.
# The ID can be found in the folder with the right mouse button > Property.
#---From Vertec version 5.0.6. Take into account the Griddef object.
#---28.11.2005, Vertec AG: created
#---15.10.2013, mw: Adapt to 5.8: xTranslation deleted, abort conditions implemented.
#---10.03.2017, sr: Script in Python created
#---21.03.2017, tk: Script is also executable on LinkContainers
#---
#---20.03.18, tik: Adapt to 6.2: Remove reference to old attributes removed (fontSize, fontName etc.)
#---
#---08.10.2021, ll: row if not sourceid.isnumeric(): modified.
#---24.11.2021, added function copymlmember and selectobjectintree.
#---01.03.2022, uhe: Language DD added.
#---02.08.2022, sth: Member 'isFixed’ added.
#---04.05.2023, tha: Functionality extended by ViewTypes, added member 'isDynamic’
#---08.05.2023, sth: copymlmember corrected, closing message added

lngList = ['DE’,'DD’,'EN’,'FR’,'IT’,'NV’]

def copymember(sourcegridcol, destinationgridcol, name):
    setattr(destinationgridcol, name, getattr(sourcegridcol, name))

def copymlmember(sourcegridcol, destinationgridcol, name):
    for lng in list(lngList):
        mlStr = sourcegridcol.getmlvalue(name, lng)
        if mlStr:
            destinationgridcol.setmlvalue(name, mlStr, lng)

def main(destination):
    #Be the current object a folder

    if not destination.eval(“oclisKindOf(AbstractFolder) or oclisKindOf(LinkContainer) or oclisKindOf(ViewType)”):
        vtcapp.msgbox('You can only execute this script on folders, Linkcontainers and Resource Planning views’)
        return
    
    if destination.eval(“oclIsKindOf(LinkContainer)”):
        destination = destination.role
    
    if destination:
        source = vtcapp.selectobjectintree(“Select list settings to copy “, [], browsefilter=”“, selectfilter=”Abstract Folder, Linkcontainer, Viewtype”)
        if source:
            #Analogue to destination
            if source.eval(“oclIsKindOf(LinkContainer)”):
                source = source.role
            #First the existing Griddef’s are deleted.
            for griddef in list(destination.griddefs):
                destination.griddefs.remove(griddef)
            #Get the GridDefs of the Source Folder
            for griddefs in source.griddefs:
                griddefd = vtcapp.createobject('GridDef’)
                destination.griddefs.append(griddefd)
                #Copy the GridDefs
                copymember(griddefs, griddefd, 'class’)
                copymember(griddefs, griddefd, 'lineheight’)
                copymember(griddefs, griddefd, 'editing’)
                copymember(griddefs, griddefd, 'ghostrow’)
                #---Can now copy the gridcoldefs.
                for gridcols in griddefs.gridcols:
                    gridcold = vtcapp.createobject('GridColDef’)
                    griddefd.gridcols.append(gridcold)
                    copymember(gridcols, gridcold, 'alignment’)
                    copymember(gridcols, gridcold, 'width’)
                    copymember(gridcols, gridcold, 'color’)
                    copymember(gridcols, gridcold, 'controlName’)
                    copymember(gridcols, gridcold, 'expression’)
                    copymember(gridcols, gridcold, 'writeableExpression’)
                    copymember(gridcols, gridcold, 'fontColor’)
                    copymember(gridcols, gridcold, 'read-only’)
                    copymember(gridcols, gridcold, 'orderIdx’)
                    copymember(gridcols, gridcold, 'isFixed’)
                    copymember(gridcols, gridcold, 'isDynamic’)                  
                    copymember(gridcols, gridcold, 'rendererName’)
                    copymember(gridcols, gridcold, 'sortOrder’)
                    copymember(gridcols, gridcold, 'summed’)
                    copymember(gridcols, gridcold, 'tabStop’)
                    copymlmember(gridcols, gridcold, 'title’)
                    copymember(gridcols, gridcold, 'controlDefinition’)
            # For folders only:
            if source.eval('oclisKindOf(AbstractFolder)') and destination.eval('oclisKindOf(AbstractFolder)'):
                destination.tabsproclass = source.tabsproclass
                
    vtcapp.msgbox('Copy completed’)

main(argobject)
Bitte wählen Sie Ihren Standort