The ABMGenerator helper is a tool to generate B4J code from a simple list of parameters. Writing only a couple of lines will generate hundreds of lines of B4J code ready to use.

It can currently generate code for CRUD modal sheets and MessageBoxes, but this will be expanded in future versions. The code is generated in the .txt files you specify, so you can then copy and paste it in your project.

The methods you can use:
Method Description
Set01FieldNames Array as String (real names in your database!)
Very important! The order of the visible fields MUST be in the order they need to appear in the ModalSheet:

Per row, Cells from left to right:

e.g. | field1 | field2 |
| field3 |
| field4 | field5 | field6 |
| field7 |

Becomes: Array As String(notvisible1, notvisible2, field1, field2, field3, field4, field5, field6, field7)
Set02RowOffsetSizes Array As String, allowed formats:
R:O:S where R=Row, O=offset, S=size (Row starts from 1, All O+S in one row must add-up To 12!)
R:OS:OM:OL:SS:SM:SL where R=Row, OS=offsetSmall, OM=offsetMedium, OL=offsetLarge, SS=sizeSmall, SM=sizeMedium, SL=sizeLarge
Empty string if not visible, e.g. an ID field
Set03LabelTexts Array as string, labels on the component.
Note: in case of a switch the format is:
"OnText,offText"
Set04ComponentTypes Array as int, using CRUDTYPE constants
Set05DefaultValue Array as string, default value when the user creates a new record.
Notes:
For Combos this must be the returnId (int, most of the time a database id, eg "123")!
For Switches/Checkboxes this must be "true" or "false"
For Dates must be a long (e.g. 145671250000), a date in the format you specified (e.g. '22-01-2016T10:20:00') or you can use "NOW"
Set06ComboQueries Array of String, combo query in format: SELECT returnId, TextToShowInCombo FROM Table WHERE your_where ORDER BY order
where can contain variables that are other fields using '$', e.g. a combo that has other values depending on who was selected in the
person combo.

You have a combo prsId to pick a person:

SELECT tPersons.prsID, tPersons.prsName
FROM tPersons
ORDER BY tPersons.prsName;

You have a combo comId to pick a command and depends on who the person is:

SELECT tCommands.comId, tCommands.comName
FROM tCommands INNER JOIN tCommandsPersons ON tCommand.comId = tCommandPersons.comprsComId
WHERE tCommandPersons.comprsPrsId=$prsId$
ORDER BY tCommands.comName

The value of what is in the prsId combo will be used in the query of the comId combo.
Set07ComboLists Array of Maps, where key = returnId and value = TextToShowInCombo
Use Null if not applicable
Set08ValidationMethods Array of strings, containing the Method names to validate an input field
Methods will be autogenerated as:

MethodName(value as String) as Boolean
Set09Enableds Array of booleans, containing booleans with enabled or not
Set10UseInUpdates Array of booleans, containing booleans if it should overwrite the field when updating a record
Note: the ID field will never be overwritten!

For example this code will generate all the code you can see in the pdf for a CRUD modal sheet. (Because it uses a DateTimeScroller, you can also define the localization here, e.g. here in Dutch). The yellow text marks the code I needed to change to modify it to the clients specific wishes.

Dim MyEventDef As ABMGeneratorCRUDDefinition
MyEventDef.Initialize("evID", "tEvent", "Vul alle velden van deze event in.", "Bewaren", "Annuleren", "Ja", "Nee", "Sluiten", "Ben je zeker dat je deze event wilt wissen?", "Gelieve eerst alle velden in te vullen!")
MyEventDef.DateTimeScroller.Mode = ABM.DATETIMESCROLLER_MODE_CLICKPICK
MyEventDef.DateTimeScroller.SQLSaveDateTimeFormat = "yyyy-MM-dd HH:mm:ss"	
MyEventDef.DateTimeScroller.TitleDateFormat = "DD" 
MyEventDef.DateTimeScroller.ReturnDateFormat = "dd/mm/yy" 
MyEventDef.DateTimeScroller.DateOrder = "ddMy" 
MyEventDef.DateTimeScroller.DateMonthNames = "['Januari','Februari','Maart','April','Mei','Juni', 'July','Augustus','September','Oktober','November','December']" 
MyEventDef.DateTimeScroller.DateMonthNamesShort = "['Jan', 'Feb', 'Maa', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dec']" 
MyEventDef.DateTimeScroller.DateDayNames = "['Zondag', 'Maandag', 'Dinsdag', 'Woensdag', 'Donderdag', 'Vrijdag', 'Zaterdag']" 
MyEventDef.DateTimeScroller.DateDayNamesShort = "['Zon', 'Maa', 'Din', 'Woe', 'Don', 'Vri', 'Zat']" 
MyEventDef.DateTimeScroller.DateMonthText = "Maand" 
MyEventDef.DateTimeScroller.DateDayText = "Dag" 
MyEventDef.DateTimeScroller.DateYearText = "Jaar" 
MyEventDef.DateTimeScroller.PickText = "Bewaar" 
MyEventDef.DateTimeScroller.CancelText = "Sluiten" 

Dim cmbStatus As String = "SELECT evstatID, evstatOms FROM tEventStatus ORDER BY evstatOms"
Dim cmbType As String = "SELECT tEventType.evtypID, tEventType.evtypOms FROM tEventType INNER JOIN tEventType_Persoon ON tEventType.evtypID = tEventType_Persoon.evtypprsEvtypID WHERE (((tEventType_Persoon.evtypprsPrsID)=1)) ORDER BY tEventType.evtypOms"
Dim cmbTodoBy As String = "SELECT prsID, prsNaam FROM tPersoon ORDER BY prsNaam"
	
MyEventDef.Set01FieldNames(       Array As String ("evID"           , "evCreator"           , "evContact"    , "evDatum"            , "evStatus"       , "evType"        , "evToDoBy"          , "evToDoDatum"      , "evOnderwerp", "evAandacht"   , "evHot"        , "evCommentaar"   , "evAfsluitDatum"    ))
MyEventDef.Set02RowOffsetSizes(   Array As String (""               , ""                    , ""             , ""                   , "1:0:12"         , "2:0:12"        , "3:0:12"            , "4:0:12"           , "5:0:12"     , "6:0:6"        , "6:0:6"        , "7:0:12"         , ""                  ))
MyEventDef.Set03LabelTexts(       Array As String (""               , ""                    , ""             , ""                   , "Status"               , "Actie"         , "Uit te voeren door", "Uitvoer datum"    , "Onderwerp"  , "Aandacht"     , "Hot,"         , "Commentaar"     , ""                  ))
MyEventDef.Set04ComponentTypes(   Array As Int    (ABM.GEN_NONE     , ABM.GEN_NUMBER        , ABM.GEN_NUMBER , ABM.GEN_DATE_SCROLL  , ABM.GEN_COMBOSQL , ABM.GEN_COMBOSQL, ABM.GEN_COMBOSQL    , ABM.GEN_DATE_SCROLL, ABM.GEN_TEXT , ABM.GEN_NUMBER , ABM.GEN_SWITCH , ABM.GEN_TEXTAREA , ABM.GEN_DATE_SCROLL ))
MyEventDef.Set05DefaultValues(    Array As String (""               , "1"                   , "1"            , "NOW"                , "2"              , "1"             , "1"                 , "NOW"              , ""           , "0"            , "false"        , ""               , "NOW"               ))	
MyEventDef.Set06ComboQueries(     Array As String (""               , ""                    , ""             , ""                   , cmbStatus        , cmbType         , cmbTodoBy           , ""                 , ""           , ""             , ""             , ""               , ""                  ))
MyEventDef.Set07ComboLists(       Array As Map    (null             , null                  , null           , null                 , null             , null            , null                , null               , null         , null           , null           , null             , null                ))
MyEventDef.Set08ValidationMethods(Array As String (""               , ""                    , ""             , ""                   , "NotMin1"        , "NotMin1"       , "NotMin1"           , ""                 , "NotEmpty"   , ""             , ""             , "NotEmpty"       , ""                  ))
MyEventDef.Set09Enableds(         Array As Boolean(False            , False                 , False          , False                , True             , True            , True                , True               , True         , True           , True           , True             , False               ))
MyEventDef.Set10UseInUpdates(     Array As Boolean(False            , False                 , False          , False                , True             , True            , True                , True               , True         , True           , True           , True             , False               ))
Generator.GenerateCRUDSheet(File.DirApp, "EventNotes", MyEventDef, ABM.MODALSHEET_SIZE_FULL)	

The generated code: Generated code