Create Simple Element Code

Depending on the type of the simple element is the metadata to load.

//Char example
&WWPFormElementParentTitle = "Main Information"
Do 'GetParentIdFromTitle'
&WWPFormElement = New()
&WWPFormElement.WWPFormElementId = &WWPFormElementId
&WWPFormElement.WWPFormElementTitle = "First Name"
&WWPFormElement.WWPFormElementType = WorkWithPlus.DynamicForms.WWP_DF_ElementType.Simple
&WWPFormElement.WWPFormElementCaption = WorkWithPlus.DynamicForms.WWP_DF_ElementCaptionType.Label
&WWPFormElement.WWPFormElementDataType = WorkWithPlus.DynamicForms.WWP_DF_DataType.Character

&WWP_DF_CharMetadata = New()
&WWP_DF_CharMetadata.ControlType = WorkWithPlus.DynamicForms.WWP_DF_CharControlType.Text
&WWP_DF_CharMetadata.Length = 200
&WWP_DF_CharMetadata.IsRequired = True

&WWPFormElement.WWPFormElementMetadata = &WWP_DF_CharMetadata.ToJson()

&WWPFormElement.WWPFormElementParentId = &WWPFormElementParentId
&WWPForm.Element.Add(&WWPFormElement)
&WWPFormElementId += 1

 

Sub 'GetParentIdFromTitle'

    For &WWPFormElement In &WWPForm.Element
        If &WWPFormElement.WWPFormElementTitle = &WWPFormElementParentTitle
            &WWPFormElementParentId = &WWPFormElement.WWPFormElementParentId
            Exit
        EndIf
    EndFor

EndSub

Char

A Structure view of the WWP_DF_CharMetadata data type shows fields ControlType, Length, IsRequired, DefaultValue, VisibleCondition, a Validations collection, and a MultipleOptions group with ControlType, AllowMultipleSelection, HasDynamicOptions, an Options collection, ComboBox (IncludeEmptyValue, EmptyText), RadioButton (DirectionVertical), and Dynamic (GetOptionsService), each with Type and Description columns.

 

Boolean

A Structure view of the WWP_DF_BooleanMetadata data type shows fields ControlType, DefaultValue, VisibleCondition, a Validations collection (Item of type WWP_DF_Validation), and a Checkbox group containing ControlTitle (VarChar 100), each with their Type and Description columns.

Date

A Structure view of the WWP_DF_DateMetadata data type shows fields IsRequired, IsDefaultValueToday, VisibleCondition, and a Validations collection (Item of type WWP_DF_Validation), each with their Type and Description columns.

Image

A Structure view of the WWP_DF_ImageMetadata data type shows fields Height and Width (Numeric 4.0), IsRequired, VisibleCondition, and a Validations collection (Item of type WWP_DF_Validation), each with their Type and Description columns.

Numeric

A Structure view of the WWP_DF_NumericMetadata data type shows fields Length (Numeric 2.0), Decimals (Numeric 1.0), IsRequired, DefaultValue (Numeric 18.5), VisibleCondition, and a Validations collection (Item of type WWP_DF_Validation), each with their Type and Description columns.