Tuesday, October 30, 2012
Dialog Boxes
static void Simple_Dialog(Args _args)
{
dialog dlg;
dialogGroup dlgGroup;
dialogField dlgField;
;
dlg = new dialog("Simple Dialog");
dlgGroup = dlg.addGroup("Customer");
dlgField = dlg.addField(TypeID(custAccount),"Account Number");
if (dlg.run())
{
print dlgField.value();
pause;
}
}
Lookup
// create in Form/Fields/fields name/Methods
public void lookup(FormControl _formControl, str _filterStr)
{
;
lookupMaster::lookupMasterNumber(_formControl);
}
//Create in class/ new method
public static boolean lookupMasterNumber(FormStringControl _ctrl)
{
SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(Master1), _ctrl);
Query query;
QueryBuildDataSource qdbsTransport;
AvVendorRoleTable avVendorRoleTable;
;
//display
sysTableLookup.addLookupfield(fieldnum(Master1, MasterNumber), true);
sysTableLookup.addLookupfield(fieldnum(Master1, MasterID));
//logic and assign table & field
query = new Query();
qdbsTransport = query.addDataSource(tablenum(Master1));
qdbsTransport.addRange(fieldnum(Master1, AvStatus)).value(queryValue(Avstatus::Approve));
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
return true;
}
Monday, October 29, 2012
Struct
static void Collection_Struct (Args _args)
{
//Create a struct with two fields
struct myCar = new struct ("int ModelYear; str Carbrand");
int i;
;
// Set values to the fields
mycar.value ("ModelYear", 2000);
mycar.value ("Carbrand", "BMW");
// Add a new field and give it a value
myCar.add ("Model", "316");
//Loop through the fields of the struct
for ( i = 1; i <= myCar.fields(); i++)
{
info ( strfmt ( "FieldType: %1, FieldName: %2, Value: %3",
myCar.fieldType ( i ), myCar.fieldName ( i ), myCar.Value ( myCar.fieldName ( i ))));
}
}
Set
static void Collection_Set (Args _args)
{
// Create a new set of type String
Set cars = new Set (Types :: String);
SetEnumerator setE;
;
// Add elements to the Set
cars.add ("Toyota");
cars.add ("Ford");
cars.add ("Mazda");
// Check to see if an element exist in the set
if (cars.in ("Toyota"))
into ("Toyota is part of the set");
//Display the content of the set
info (cars.toString());
// Get the enumerator of the set to loop through it
setE = cars.getEnumerator();
while (setE.moveNext())
{
info(setE.current());
}
}
Map
static void Collection_Map (Args _args)
{
// Create a new map with a key and value type
Map cars = newMap (Types :: Integer, Type :: String);
MapEnumerator mapE;
;
// Insert values to the map
cars.insert (1, "Volvo");
cars.insert (2, "BMW");
cars.insert (3, "Chrysler");
//Display the content of the map
info (cars.toString()) ;
// Get the enumerator to loop
// through the elements of the map
mapE = cars.getEnumerator();
while (mapE.moveNext())
{
info (strfmt ("Car %1: %2, mapE.currentKey(), mapE.currentKey());
}
}
List
static void Collection_List(Args _args)
{
// Create a new list of type string
List names = new List (Types :: String);
ListEnumerator listE;
;
// Add elements to the list
names.addEnd ("Lucas");
names.addEnd ("Jennifer");
names.addEnd ("Peter");
// Display the content of the list
info (names.toString());
// Get the enumerator of the list
// to loop through it
listE = names.getEnumerator();
while (listE.moveNext())
{
info ( strfmt ("Name: %1", listE.current()));
}
}
While select full statement
[while] select [reverse] [firstfast] [firstonly]
[forupdate] [nofetch] [crosscompany]
[forcelitterals | forceplaceholders] [forcenestedloop]
[forceselectorder]
[ * | <fieldlist> from] <tablebuffer>
[ index [hint] <indexname> ]
[ group by {<field>} ]
[ order by {<field> [asc][desc]} ]
[ where <expression> ]
[ [ outer | exists | notexists ] join [reverse]
[ * | <fieldlist> from] <tablebuffer>
[ index <indexname> ]
[ aggregate [sum] [avg] [minof] [maxof] [count]]
[ group by {<field>} ]
[ order by {<field> [asc][desc]} ]
[ where <expression> ]
]
<fieldlist> ::= <field> | <fieldlist> , <field>
<field> ::= fieldname | <function>(<field>)
<function> ::= sum | avg | minof | maxof | count
Subscribe to:
Posts (Atom)