banner banner Skip to main content

Option Vs Switch


Option: -

     In TDL Option is an attribute which can be used by various definitions, to provide a conditional     result in a program. The ‘Option’ attribute can be used in the ‘Menu’, ‘Form’, ‘Part’, ‘Line’, ‘Key’, ‘Field’, ‘Collection’, ‘Import File’ and ‘Import Object’ definitions.
Syntax





Option : Optional definition :  Logical Condition
Where,
is the name of a definition, defined as optional definition using the Definition modifier!

If the ‘Logical’ value is set to TRUE, then the Optional definition becomes a part of the original definition, and the attributes of the original definition are modified based on this definition.

Example: -  


If you want to add the option in field the you can use following syntax.


[Field : FldMain]
     Option : FldFirst : cond1 
    Option : FldSecond: cond2 
The field FldFirst is activated when cond1 is true. The field FldSecond is activated when cond2 is true. Optional definitions are created with the symbol prefix "!" as follows:
      [!Field : FldFirst] 
            [!Field : FldSecond]


Switch  :
The ‘Switch - Case’ attribute is similar to the ‘Option’ attribute, but reduces the code complexity and improves the performance of the TDL Program. The ‘Option’ attribute compulsorily evaluates all the conditions for all the options provided in the description code, and applies only those which satisfy the evaluation conditions. The attribute ‘Switch’ can be used in scenarios where evaluation is carried out only till the first condition is satisfied. Apart from this, ‘Switch’ statements can be grouped using a label. Therefore, multiple switch groups can be created, and zero or one of the switch cases could be applied from each group.
Syntax

Switch: Label: Desc name : Condition

Example 
[Field: Sample Switch] 
 Set as : "Default Value"
Switch : Case1: Sample Switch1: ##SampleSwitch1
Switch : Case1: Sample Switch2: ##SampleSwitch2
Switch : Case1: Sample Switch3: ##SampleSwitch3
Switch : Case2: Sample Switch4: ##SampleSwitch4

Popular posts from this blog

Tally ODBC Driver Issue

Based on the Operating System bit (32/64) Tally has given the Exe. However the Micro Soft Excel application should be compatible to O/S and Tally.ERP9. Please note, On 64 Bit OS and 64Bit Tally.ERP9, a 32 Bit Excel application can act as a server with following steps. Please download from the Portal- ‘Microsoft Access Database Engine 2010 Redistributable’.  1. Install AccessDatabaseEngine_x64.exe Installed (steps given below separately.) 2. Excel 32 Bit (Excel 2003) Installed – and acting as server 3. Tally 64 Bit As Client –                      with ODBC Driver [ODBC: "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:Tally.ERP 9 4.5 Build 7Sample Data.xls;"] and  Tally 32 Bit as Client – with ODBC Driver [ODBC : "Driver={Microsoft Excel Driver *.xls)};DBQ=Sample Data.xls"] This will resolve the problem by NOT upgrading MS Office to 64 bit. you can continue using 32 bit application of Excel.

LOG In function

During expression evaluation, intermediated values of the expression can be passed to calculator window and a log file ‘tdlfunc.log’ inside the application directory. This is very much helpful for debugging the expression. By default, logging is enabled inside the function. Syntax LOG : < Expression> Where, is the expression whose value needs to be passed to the calculator window. [Function : GetCurrentUserApprovelAmt] Parameter : PsvCurrentUser : String Variable : ApprovelAMT : Amount Return : Amount  10 : Walk Collection : ApprovelRequredColl  11 : If : $CustVAUser =  ##PsvCurrentUser  12 : Set : ApprovelAMT : $ApprovelAmount  12A : Log : ##ApprovelAMT  13 : End If  14 : End Walk  15 : Return : ##ApprovelAMT

Differences between Applications and DLLs

Differences between Applications and DLLs Even though DLLs and applications are both executable program modules, they differ in several ways. To the end user, the most obvious difference is that DLLs are not programs that can be directly executed. From the system's point of view, there are two fundamental differences between applications and DLLs: An application can have multiple instances of itself running in the system simultaneously, whereas a DLL can have only one instance. An application can own things such as a Stack, Global memory, File handles, and a message queue, but a DLL cannot.