Object/Collection Related Actions
Modify Object
The action Modify Object has been enhanced to alter a method of an object at any level. ‘Modify Object’ also supports modifying multiple values of an object. Multiple values can be specified as a comma separated list of <Method Name> : <Value> pairs.
Syntax
Action : Modify Object : <PrimaryObjectSpec>.<SubObjectPathSpec> .MethodName : value> [,Method Name : <value> , …]+
[,<SubObjectPathSpec>.MethodName : <value>, …..]
The specifications given for <PrimaryObjectSpec>, <SubObjectPathSpec>, MethodName remain the same as described in the New Method syntax section.
A single ‘Modify Object’ action cannot modify Multiple Objects, but can modify multiple values of an Object.
‘Modify Object’ is allowed to have Primary Object Specification only once, that is, for the first value. Further values permissible are optional Sub Objects and Method Specification only.
Sub Object Specification is optional for second value and onwards. If Sub Object Specification is specified, the context is assumed to be the Primary Object specified for the first value. In absence of Sub Object Specification, the previous value specification’s Leaf Object is considered as the context.
Example: 1
[Key : Alter My Object]
Key : Ctrl + Z
Action : Modify Object :(Ledger,”MyLedger”).BillAllocations [First,$Name=”MyBill”].OpeningBalance +
: 100,..Address[Last].Address : “Bangalore”
Existing ledger My Ledger is being altered with new value for opening balance of existing bill bearing Name as MyBill and last line of Address. Key Alter My Object can be attached to any Menu or Form, clicking which, the above will be altered.
Example: 2
[Key : Alter My Object]
Key : Ctrl + Z
Action : Modify Object :(Ledger,”MyLedger”).BillAllocations[1].OpeningBalance : 1000, Name:”My New Bill”,+
..Address[First].Address : “Hongasandra Bangalore”, + Opening Balance : 5000
Existing ledger My Ledger is altered with new values for opening balance for existing bill, opening balance of ledger and address. Key Alter My Object can be attached to any Menu or Form.
Example: 3
[Key : Alter My Object]
Key : Ctrl + Z
Action:ModifyObject:LedgerEntries[1].BillAllocations[1].Name : “Test1”, Amount :“1000.00”, ..BillAllocations[2]+
.Name:“Test2”, Amount : “2000.00”, ().Date : “1.4.08”
In a Voucher context, Key Alter My Object alters the Name, Amount and Date methods of the Sub object Bill Allocations in one line.
Action ‘Modify Object’ in a Menu Definition
In Menu definition, a button which has the action ‘Modify Object’, can be added.
Example
[#Menu : Gateway of Tally]
Add : Button : Alter My Object
While associating a key with action ‘Modify Object’, the following points should be considered:
- Since menu does not have any Data Objects in context, specifying Primary Object becomes mandatory.
- Since Menu cannot work on scopes like Selected Lines, Unselected Lines, etc., scopes specified are ignored.
- Any formula specified in the value is evaluated assuming Menu Object as the requestor.
- Even Method values pertaining to Company Objects can be modified.
- A button can be added at the menu to specify the action Modify Object at the Menu level
Set Object Values
This new action is similar to the action ‘Modify Object’. The action ‘Set Object Values’ works only in the ‘Edit’ mode of a Report, as it uses current context. This action changes the values of the object from current context, as specified.
Syntax
Action : Set Object Values : <SubObjectPathSpec>.<Method Name>: <Method Value>
Where,
< SubObjectPathSpec > is given as CollectionName [<Index Formula>, [<Condition>]]
< MethodName > refers to the name of the method in the specified path, and
< Method Value > is the value to be set for <Method Name>.
This action alters the current object in memory. When the Primary object is saved, the changes will be updated in Tally database.
Example
[Key : My Key]
Action : Set Object Values : Opening Balance : ($$AsAmount : 10)