Updating a field in a Master TStruct – Example

Want create site? Find Free WordPress Themes and plugins.

 Scenario : Stock Management in a store

In a store, when a sale is made, the stock available  has to be reduced. In any ordinary application development platform this will require some amount of coding. In Axpert,  the above task can be accomplished in a few minutes using an MDMap.

To demonstrate this we need two TStructs – Inventory Master and Item Issued.All the items are maintained in the Inventory Master and the items sold are recorded in the Item Issued. When an item is sold, it is saved in the Item Issued and the opening quantity of this item is to be reduced from the Inventory Master.

Follow the steps in Steps to create a TStruct to define the Inventory Master TStruct and an Item Issued TStruct. The TStruct definitions are as given below.

Inventory Master

Type Name Caption Properties
TStruct invnt Inventory Master TransId = invnt
DC dc1 Master TableName= inventory
InputField ItemCode Item Code DataType = Character
DataWidth=15
AllowEmpty=False
AllowDuplicate = False
InputField ItemName Item Name DataType = Character
DataWidth=50
AllowEmpty=False
AllowDuplicate = False
InputField OpeningQty Opening Qty DataType = Numeric
InputField Rate Rate DataType = Numeric

Item Issued TStruct

Type Name Caption Properties
TStruct item Item Issued TransId = item
DC dc1 Detail TableName= itemissued
InputField ItemCode Item Code Data Type = Character
Data Width =15
ModeOfEntry = Select
Details : From TStructSelect TStruct = Inventory Master
Select Field to list in Selection Window = ItemCode
InputField ItemName Item Name Data Type = Character
Data Width =50
ModeOfEntry = Fill
Details  :Master = ItemCode
Source = ItemName
InputField IssueQty Issued Qty DataType = Numeric
  • In the Item Issued TStruct, insert an MDMap control.Set the properties as follows:
Type Name Properties
MDMap Caption = Stock Issue Update
MasterTransaction = Inventory Master
Master Field  = OpeningQtyDetail Field = IssueQty
MasterSearchField = Default
Detail Search Field = ItemCode
Update Type = Less
  • Save the TStruct definition .
  • Click Run. Open the Inventory Master Form and enter some sample data and save. (Assume that for Item C, the opening quantity is 2000). Close the Inventory Master.
  • Open the Item Issued Form, select an item and enter the Issued quantity. Let the issued quantity for the Item C be 1000. Save the information entered and close the form.
  • Open the Inventory Master; click to view the list of items. The Opening Quantity of the issued item will be displayed as 1000.

 

Did you find apk for android? You can find new Free Android Games and apps.