Repository navigation
First steps
This page builds a small stock application: products, a receipt document that brings goods in, a register that keeps the balance, and a report that reads it. It takes about fifteen minutes and touches each part of the designer once.
- Start
launcherand press Add. - Name the base
Stock, choose File (local database), and pick an empty folder. - Press Save connection, select the base and press Designer.
The designer opens with an empty configuration. On the left is the metadata tree; selecting anything in it shows its properties.
- In the tree, right-click Catalogs → New. Name it
Products. - A catalog already has a code and a description. Add one more attribute: open the catalog,
go to Attributes, add
Unitof type String.
- Right-click Accumulation registers → New. Name it
Stock. - Under Dimensions, add
Productof type Catalog reference: Products. - Under Resources, add
Quantityof type Number.
A dimension is what the balance is broken down by. A resource is what is summed.
- Right-click Documents → New. Name it
Receipt. - Under Tables, add a table
Goodswith columnsProduct(Catalog reference: Products) andQuantity(Number). - In the document's properties, set List register record to include
Stock. These are the registers the document may write to. - Open its object module (right-click the document → Open object module) and write what posting does:
procedure Posting(Cancel, PostingMode) {
foreach (row in Goods) {
var rec = RegisterRecords.Stock.Add();
rec.RecordType = AccumulationRecordType.Receipt;
rec.Period = Date;
rec.Product = row.Product;
rec.Quantity = row.Quantity;
}
}The handler's name, Posting, is fixed: the platform calls it when the document is posted and
writes the records it collected. The editor completes names as you type (Ctrl+Space), so the
exact spelling of each field is always one keystroke away.
- Press Save metadata on the toolbar. The designer writes the configuration into the base and creates the tables.
- Debug → Start without debugging starts Enterprise on the same base.
- In Enterprise, add two or three products, then create a receipt, fill its table and post it.
You did not draw a single form. The platform generated them from the metadata. To draw your own, see Forms.
A query that reads the register's balance, as of now:
SELECT B.Product, B.QuantityBalance
FROM AccumulationRegister.Stock.Balance(&At) AS BRun it from code:
var q = new Query("SELECT B.Product, B.QuantityBalance FROM AccumulationRegister.Stock.Balance(&At) AS B");
q.SetParameter("At", CurrentDate());
var table = q.Execute().Unload();or make it a Report and let the report composer group, total and print it. See Queries and reports.
- Set a breakpoint in
Postingand use Debug → Start debugging to step through it. - Add a role under Common → Roles to decide who may read and post receipts.
- Let an assistant do the same steps: Building a configuration with an assistant.
Getting started
The designer
Running it