Anwendungsbeispiele
Erstellen
einer neuen Adresse.
function CreateNewAddr() : void
{
bo newAddr := Addr
if(AddrCus.AddrNoIsAuto = FALSE)
{ newAddr.Number := AddrCus.NextAddrNo }
newAddr.SalutNo := '1'
newAddr.FirstName := 'Roman'
newAddr.LastName := 'Vonwil'
newAddr.Street := 'Erlen'
newAddr.HouseNo := '4'
newAddr.CountrySc := 'CH'
newAddr.Zip := '6375'
newAddr.City := 'Beckenried'
var result := newAddr.Save()
throw newAddr.Number
}
Erstellen einer BO-Instanz und Laden des BO.
function BoActivation() : void
{
XFAS.AddHeads('command','result')
// erstellen der BO Instanz
bo addr := Addr
var activated := FALSE
// Laden des B0s via ID
activated := addr.LoadByBoId(2020)
XFAS.AddCells("addr.LoadByBoId(2020)",addr.FullName +' > (activated: '+string(activated)+')')
// Laden einer ungültigen ID --> activated = FALSE
activated := addr.LoadByBoId('WRONG!')
XFAS.AddCells("addr.LoadByBoId('WRONG!')",addr.FullName +' > (activated: '+string(activated)+')')
}
BO laden (Late Binding).
function BO_Loading_LateBinding() : void
{
XFAS.AddHeads('command','result')
bo cat := Cat
var activated := FALSE
activated := BO.LoadByBoId(cat, 2020)
XFAS.AddCells("BO.LoadByBoId(cat, 2020)",activated)
activated := BO.LoadByBoKey(cat, 2, 'ROMANS TestKatalog, 2020')
XFAS.AddCells("BO.LoadByBoKey(cat, 2, 'ROMANS TestKatalog, 2020')",activated)
activated := BO.LoadByBoKeySegments(cat, 2, 'ROMANS TestKatalog','2020')
XFAS.AddCells("BO.LoadByBoKeySegments(cat, 2, 'ROMANS TestKatalog','2020')",activated)
}
BO-Attribute (Late Binding).
function BO_Attributes_LateBinding() : void
{
XFAS.AddHeads('command','result')
bo cat := Cat
BO.LoadByBoId(cat, 2020)
var returnValue := ''
// Attribut-Wert abfragen
returnValue := BO.GetAttr(cat, 'Name')
XFAS.AddCells("BO.GetAttr(cat, 'Name')",returnValue)
returnValue := BO.GetAttr(cat, 'Free5')
XFAS.AddCells("BO.GetAttr(cat, 'Free5')",returnValue)
// Einen Attribut-Wert zuweisen
returnValue := BO.SetAttr(cat, 'Free5',timestampToStr(now(),'dd.MM.yyyy'))
XFAS.AddCells("BO.SetAttr(cat, 'Free5',timestampToStr(now(),'dd.MM.yyyy')",returnValue)
// Speichern der geänderten Attribute
returnValue := BO.Save(cat, TRUE, FALSE, TRUE, TRUE)
XFAS.AddCells("BO.Save(cat, TRUE, FALSE, TRUE, TRUE",returnValue)
// Geänderten Attribut-Wert abfragen
returnValue := BO.GetAttr(cat, 'Free5')
XFAS.AddCells("BO.GetAttr(cat, 'Free5')",returnValue)
// Abfragen von Attributen mit Qualifier
returnValue := BO.GetAttr(cat, 'IsActiveLang@@1')
XFAS.AddCells("BO.GetAttr(cat, 'IsActiveLang@@1')",returnValue)
// Abfragen von MetaInfos
returnValue := BO.GetAttr(cat,'StructLayoutType1Value?RelatedConstraint')
XFAS.AddCells("BO.GetAttr(cat,'StructLayoutType1Value?RelatedConstraint')",returnValue)
}
Laden einer BO-Instanz.
function BO_Loading_Instance() : void
{
XFAS.AddHeads('command','result')
bo cat := Cat
var activated := FALSE
activated := cat.LoadByBoId('2020')
XFAS.AddCells("cat.LoadByBoId('2020')",activated)
activated := cat.LoadByBoKey(2,'ROMANS TestKatalog, 2020')
XFAS.AddCells("cat.LoadByBoKey(2,'ROMANS TestKatalog, 2020')",activated)
activated := cat.LoadByBoKeySegments(2,'ROMANS TestKatalog','2020')
XFAS.AddCells("cat.LoadByBoKeySegments(2,'ROMANS TestKatalog','2020')",activated)
}
Abfragen, Zuweisen, Speichern und erneut Abfragen von
Attribut-Werten.
function BO_Attributes_Instance() : void
{
XFAS.AddHeads('command','result')
bo cat := Cat
cat.LoadByBoId(2020)
var returnValue := ''
// Attribut-Wert abfragen
returnValue := cat.Name
XFAS.AddCells('cat.Name',returnValue)
returnValue := cat.Free5
XFAS.AddCells("cat.Free5",returnValue)
// Einen Attribut-Wert zuweisen
cat.Free5 := dateAdd(timestampToStr(now(),'dd.MM.yyyy'),1,'D')
XFAS.AddCells("cat.Free5 := dateAdd(timestampToStr(now(),'dd.MM.yyyy'),1,'D')",cat.Free5)
// Speichern der geänderten Attribute
returnValue := cat.Save()
XFAS.AddCells("cat.Save()",returnValue)
// Geänderten Attribut-Wert abfragen
returnValue := cat.Free5
XFAS.AddCells("cat.Free5",returnValue)
// Abfragen von Attributen mit Qualifier
returnValue := cat.IsActiveLang@@1
XFAS.AddCells("cat.IsActiveLang@@1",returnValue)
// Abfragen von MetaInfos
returnValue := cat.StructLayoutType1Value?RelatedConstraint
XFAS.AddCells("cat.StructLayoutType1Value?RelatedConstraint",returnValue)
}
BO Kontext.
function Bo_Context() : void
{
bo boInstance := Art
boInstance.LoadByBoKey(1, '2020')
XFAS.AddHeads('Number','Free6?Format','Free6?DataType','Free6?Name@51')
XFAS.AddCells(boInstance.Number,boInstance.Free6?Format,boInstance.Free6?DataTypeCd,boInstance.Free6?Name@51)
boInstance.LoadByBoKey(1, '2020.LEISTUNG')
XFAS.AddCells(boInstance.Number,boInstance.Free6?Format,boInstance.Free6?DataTypeCd,boInstance.Free6?Name@51)
}