F-Script Beispiele - Übersicht

Beispiele

Lfn
Beschreibung
Verfügbarkeit
Link
0001
Demo-Script: Verwendung von ST-BaseTools.FBS
    // ---------------------------------------------------------------------------------------------------------
    // Basic Toolbox for BlockScript
    // Kontext:  BlockScript
    // ---------------------------------------------------------------------------------------------------------
    // Erstellt: 01.07.2023 - (c) Opacc Laboratory AG - Roman Vonwil
    // ---------------------------------------------------------------------------------------------------------
    {
        using "ST-BaseTools.FBL"

        function Demo_Library() : void
        {
            // arg1: Collection
            // arg2: Library-File
            // arg3: Delimiter (default: "|")
            // arg4: FolderName (default: "F_Scripts")
            Library_Init('Collection','RV-TESTLibrary.LB')
            // arg1: CollectionName
            // arg2: Key welcher gesucht werden soll
            var libValue := Library_GetValue('Collection', 'Key1')

            XFAS.AddHeads('Library.Key','Library.Value')
            XFAS.AddCells('Key1',libValue)
        }

        function Demo_Read_FileContent() : void
        {
            // -----------------------------------------------------------------------------------------------------------------------------------------------------
            // Read complete file
            var fileName     := 'bo.addr.csv'
                                // arg1: filePathAndName
                                // arg2: fileEncoding (default: auto)
                                // arg3: fileChannel  (default: 4)
            var fileContent :=  Read_GetFullFileContent('..\\Tx\\test\\'+fileName,'utf8bom')

            XFAS.AddHead('FileContent')
            XFAS.AddCell(fileContent)
        }

        function Demo_Read_LineByLine() : void
        {
            var fileName     := 'bo.addr.csv'
            // -----------------------------------------------------------------------------------------------------------------------------------------------------
            // Read file "line by line"
            var channelNo     := 1
                // arg1: filePathAndName
                // arg2: fileEncoding (default: auto)
                // arg3: fileChannel  (default: 4)
            if( Read_InitFile('..\\Tx\\test\\'+fileName,'utf8bom',channelNo) = FALSE )
            { throw "can't open file!"     }


            XFAS.AddHead('LineContent')
            while(READ.IsAtEnd(channelNo) = FALSE)
            {
                                // arg1: fileChannel  (default: 4)
                var lineContent := Read_GetNextContentLine(channelNo)
                XFAS.AddCell(lineContent)
            }
        }
        function Demo_Logging_LogMessage() : void
        {
            // arg1: logMessage
            // arg2: createTimeStamp (default: false)
            Logging_SetLogMessage('Test AAA',TRUE)
            Logging_SetLogMessage('Test BBB',TRUE)
            Logging_SetLogMessage('Test CCC',TRUE)
            // arg1: logMessage
            // arg2: filePathAndName
            // arg3: fileEncoding     (default: utf8)
            // arg4: fileChannel      (default: 4)
            // arg5: appendFile     (default: FALSE)
            Logging_WriteLogMessage(X.Get('LogMessage'),'..\\tmp\\testfile.log')
            Logging_WriteLogMessage('this is the test','..\\tmp\\testfile.log')
        }

        function Demo_BOCreation() : void
        {
            var boName := 'FreeTable'
            /// Description:    Add value to SaveBoArguments
            /// Arguments:        boName             : string    > BoType
            ///                 argName            : string    > BoType.BoAttribute
            ///                 argValue        : string    > Value
            ///                 assingAsString    : boolean    > default: true
            /// Return:            returnValue     : void
            BOCreation_AddArgument(boName,'FreeTable.Number',yearOfDate(now())+1,FALSE)
            BOCreation_AddArgument(boName,'FreeTable.ShortName@@1','Kurzbezeichnung')
            BOCreation_AddArgument(boName,'FreeTable.Name@@1','Bezeichnung')

            /// Description:    Execute BOCreation
            /// Arguments:        boName             : string    > BoType
            /// Return:            returnValue        : string    > resultName
            var resultName     := BOCreation_Execute(boName)
            var rows        := XRES.GetNmbOfRows(resultName)
            var logMessage    := XRES.GetMsgText(resultName)
        }

        function Demo_BOMutation() : void
        {
            var boName         := 'FreeTable'
            var startKey     := yearOfDate(now())+1

            /// Description:    Set selection for items that should be mutated
            /// Arguments:        boName                 : string    (must)
            ///                 startKey            : string    (must)
            ///                    searchOperationCd    : string     > default: eif
            ///                    boIndex                : string    > default: ''
            ///                    saveBoProcessingCd    : string    > default: '1'
            ///                    fixedSegsOfBoIndex    : string    > default: ''
            ///                    saveBoModeCd        : string    > default: '2'
            ///                    withReport            : string    > default: '1'
            ///                    filter                : string    > default: ''
            ///                    resultObject        : string    > default: ''
            /// Return:            returnValue     : void
            BOMutation_SetSelection(boName,startKey)

            /// Description:    Add value to SaveBoArguments
            /// Arguments:        boName             : string    > BoType
            ///                 argName            : string    > BoType.BoAttribute
            ///                 argValue        : string    > Value
            ///                 assingAsString    : boolean    > default: true
            /// Return:            returnValue     : void
            BOMutation_AddArgument(boName,'FreeTable.ShortName@@1','MyNew ShortName')
            BOMutation_AddArgument(boName,'FreeTable.Name@@1','The Table!')

            /// Description:    Execute BOCreation
            /// Arguments:        boName             : string    > BoType
            /// Return:            returnValue        : string    > resultName
            var resultName     := BOMutation_Execute(boName)
            var rows        := XRES.GetNmbOfRows(resultName)
            var logMessage    := XRES.GetMsgText(resultName)
        }


        function Demo_Transformer() : void
        {
            var resultName := Helper_GetData('Addr')
            /// Description:    Transformas a XRES-Result to an XFAS table (Clears previous XFAS!)
            /// Arguments:        resultName             : string    > name of the resultobject
            /// Return:            returnValue            : void         > XFAS table
            Transform_XRES_2_XFAS(resultName)
        }
        function Helper_GetData(var boName := 'Addr') : string
        {
            // -----------------------------------------------------------------------------------------------------
            X.Set('GetBo.BoType',    boName)
            X.Set('GetBo.Start',    '')
            X.Set('GetBo.Seek',        'ne')
            X.Set('GetBo.Index',    '')
            X.Set('GetBo.Count',    '10')
            X.Set('GetBo.Fixed',    '0')
            X.Set('GetBo.Filter',    '')
            X.Set('GetBo.Return',    '')
            X.Set('GetBo.Virt1',    '')
            X.Set('GetBo.VCount',    '1')
            X.Set('Log.Message',     '')
            // -----------------------------------------------------------------------------------------------------
            // Subroutine aus ST-BlockServices.FBL aufrufen
            return BlockServices_GetBo('Get'+boName,FALSE,FALSE) // requestName,crossClient,returnAsXFAS
        }
    }
    
23.02.00
0002
Demo-Script: Öffnen von BC Nr gem. DeskItem
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     09.03.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.06
0003
Demo-Script: Lokale Datei hochladen
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     02.06.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.07
0004
Demo-Script: Öffnen von Dateien
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     09.03.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.02
0005
Demo-Script: Verwenden von GetInfoScriptCols in F-Script (F-Script/BlockScript)
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     07.20.2024 - (c) Opacc Laboratory AG - Roman Vonwil
    # ------------------------------------------------------------------------------------------------------
    
16.20.07
0006
Demo-Script: Ersetzen von ALT-174 / ALT-175 («/») in F-Scirpt
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem 
    # Erstellt:     14.05.2018 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.01
0007
Demo-Script: ScriptBlock-Funktionen - Verwendung von XTAB
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     16.07.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.07
0008
DEMO-Script: Verwendung von SPLIT in F-Script
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     20.07.2016 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------
    
16.00.01
0009
Demo-Script: Verwendung von ST-SysAdmin.FBS
// ---------------------------------------------------------------------------------------------------------
// SysAdmin Toolbox for BlockScript
// Kontext:  BlockScript
// ---------------------------------------------------------------------------------------------------------
// Erstellt: 01.07.2023 - (c) Opacc Laboratory AG - Roman Vonwil
// ---------------------------------------------------------------------------------------------------------
{
using "ST-SystemAdmin.FBL"
function Demo_EncryptPasswordForAssembly() : void
{
    /// Description:    Password Encryption for Assemly 🔐
    /// Arguments:        plainPassword         : string    > default: ''
    ///                    assemblyName        : string     > default: 'Opacc.ServiceBus.Connector.Biz.Df'
    /// Return:            returnValue            : string     > encryptedPassword

    var encryptedPassword := SystemAdmin_EncryptPasswordForAssembly('TEST')
}
function Demo_EchoWithDelay() : void
{

    /// Description:    Echo with Deplay aka «SYS(WAIT)» 😎
    /// Arguments:        milliseconds         : string    > default: 100
    ///                    searchOperationCd    : string     > default: 'echo'
    /// Return:            returnValue            : void
    var result := SystemAdmin_EchoWithDelay(1000)
}
function Demo_GetMaintenanceWindow() : void
{

    /// Description:    Gets maintenance windows 🚧
    /// Arguments:        milliseconds         : string    > default: 100
    ///                    searchOperationCd    : string     > default: 'echo'
    /// Return:            returnValue            : string    > resultName
    var resultName     := SystemAdmin_GetMaintenanceWindow()
}
}    
    
23.02.00
0010
DEMO-Script: Time- und TimeStamp-Funktionen
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     06.03.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------
    
16.20.07
0011
Demo-Script: Lokale Datei hochladen
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     02.06.2020 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------    
    
16.20.07
0012
DEMO-Script: Verwendung von XARR innerhalb F-Script
    # ------------------------------------------------------------------------------------------------------
    # Kontext:      DeskItem
    # Erstellt:     20.07.2016 - (c) Opacc Laboratory AG - Roman Vonwil 
    # ------------------------------------------------------------------------------------------------------
    
16.00.01