regarding grids with form

How can we get in uploaded Document name ,uploaded by and uploaded on in supervisor form using grids of 3 column.

  Discussion posts and replies are publicly visible

Parents
  • Assuming that document is already uploaded, as Stefan notes, you can retrieve those properties using the document() function, such as:

    a!localVariables(
      local!doc: /* Your Document(s) here */,
    
      a!gridLayout(
        headerCells: {
          a!gridLayoutHeaderCell(label: "Document Name"),
          a!gridLayoutHeaderCell(label: "Uploaded By"),
          a!gridLayoutHeaderCell(label: "Uploaded On")
        },
        rows: a!forEach(
          items: local!doc,
          expression: a!gridRowLayout(
            id: fv!index,
            contents: {
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"name")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"lastUserToModify")
                )
              ),
              a!richTextDisplayField(
                value: a!richTextItem(
                  text: document(fv!item,"dateCreated")
                )
              )
            }
          )
        )
      )
    )

  • a!localVariables(

    local!doc:/* your documents here*/

    So here documents in the sense target documents or what?

    So my target documents here cons!name of file.

  • The local!doc variable would point to the document or list of documents you want to display these details for.  If your documents are stored in a constant (?) you would point to that constant.

    I'm not sure exactly what you mean with "target documents here cons!name of file", do you have a constant that stores the text name of the document?  Versus having the document object type or document ID?

  • a!formLayout(
    label: "Add Vehicle to Fleet",
    contents: {
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!textField(
    label: "Vehicle Make",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleMake,
    saveInto: ri!vehicle.vehicleMake,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleMake
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleMake
    ) & " characters.",
    null
    )
    ),
    a!paragraphField(
    label: "Vehicle Condition",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleCategory,
    saveInto: ri!vehicle.vehicleCategory,
    required: true,
    requiredMessage: "ri!vehicle.mileage > 500",
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleCategory
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleCategory
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle VIN",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleVIN,
    saveInto: ri!vehicle.vehicleVIN,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleVIN
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleVIN
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Status",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: "Initiated",
    saveInto: ri!vehicle.vehicleStatus,
    showWhen: true,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleStatus
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleStatus
    ) & " characters.",
    null
    )
    ),
    a!dateField(
    label: "Vehicle Last Modified By",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleLastModifiedBy,
    saveInto: ri!vehicle.vehicleLastModifiedBy,
    readOnly: ri!readOnly
    ),
    a!dateField(
    label: "Vehicle Added By",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleAddedBy,
    saveInto: ri!vehicle.vehicleAddedBy,
    readOnly: ri!readOnly
    ),
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle Photos",

    labelPosition: "ABOVE",
    target: cons!SG_vehicle_photos,

    value: ri!vehicle.vehiclePhotos,
    saveInto: ri!vehicle.vehiclePhotos,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), { "PNG", "JPG" ,"JPEG"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be images. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle insurance number",
    labelPosition: "ABOVE",
    target: cons!SG_Insurance_Document,

    value: ri!vehicle.vehicleInsurancenumber,
    saveInto: ri!vehicle.vehicleInsurancenumber,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), {"PDF"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be PDF. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )

    )
    }
    ),
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle ownersID proof",
    labelPosition: "ABOVE",
    target: cons!SG_ID_PROOF,

    value: ri!vehicle.ownersIDProof,
    saveInto: ri!vehicle.ownersIDProof,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), {"PDF"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be PDF. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    }
    )
    }
    ),
    a!dateTimeField(
    label: "Vehicle Last Maintenance Date",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleLastMaintenanceDate,
    saveInto: ri!vehicle.vehicleLastMaintenanceDate,
    readOnly: ri!readOnly
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Vehicle Model",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleModel,
    saveInto: ri!vehicle.vehicleModel,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleModel
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleModel
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Colour",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleColour,
    saveInto: ri!vehicle.vehicleColour,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleColour
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleColour
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Condition",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleCondition,
    saveInto: ri!vehicle.vehicleCondition,
    showWhen: ri!readOnly = true(),
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleCondition
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleCondition
    ) & " characters.",
    null
    )
    ),
    a!integerField(
    label: "Vehicle Year",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleYear,
    saveInto: ri!vehicle.vehicleYear,
    readOnly: ri!readOnly
    ),
    a!integerField(
    label: "Vehicle Mileage",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleMileage,
    saveInto: ri!vehicle.vehicleMileage,
    readOnly: ri!readOnly
    ),
    a!dropdownField(
    label: "Category",
    labelPosition: "ABOVE",
    placeholderLabel: "upload related documents by selecting applicable category",
    choiceLabels: cons!SG_VEHICLE_CATEGORIES,
    choiceValues: cons!SG_VEHICLE_CATEGORIES,
    value: ri!vehicle.vehicleCategory,
    saveInto: ri!vehicle.vehicleCategory,
    showWhen: or(
    isnull(ri!readOnly),
    ri!readOnly=false()
    ),
    validations: {}
    ),
    a!dateField(
    label: "Vehicle Date Added",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleDateAdded,
    saveInto: ri!vehicle.vehicleDateAdded,
    readOnly: ri!readOnly
    ),
    a!dateTimeField(
    label: "Vehicle Next Maintenance Date",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleNextMaintenanceDate,
    saveInto: ri!vehicle.vehicleNextMaintenanceDate,
    readOnly: ri!readOnly
    ),
    a!dateField(
    label: "",
    labelPosition: "ABOVE",
    saveInto: {},
    validations: {}
    ),
    a!dateField(
    label: "vehicleNextServiceDate",
    labelPosition: "ABOVE",
    value: ri!vehicle.vehicleNextServiceDate,
    saveInto: ri!vehicle.vehicleNextServiceDate,
    readOnly: false,
    validations: {}
    )
    }
    )
    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!fileUploadField(
    label: "Rc document",
    labelPosition: "ABOVE",
    instructions: "only PNG or JPEG or JPG format applicable.",
    target: cons!SG_document_folder_pointer,

    value:ri!vehicle.vehicleRCNumber,
    saveInto:ri!vehicle.vehicleRCNumber,
    showWhen: if(ri!vehicle.vehicleCategory=cons!SG_VEHICLE_CATEGORIES[1],true(),false()),

    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), { "PNG", "JPG" ,"JPEG"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be images. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    )
    }
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: {
    a!buttonWidget(
    label: "Submit",
    value: if(
    isnull(ri!vehicle.vehicleLastModifiedBy), "",
    rule!VFM_CalculateNextServiceDate(
    ri!vehicle.vehicleCategory,
    ri!vehicle.vehicleLastModifiedBy
    )),
    saveInto: {ri!vehicle.vehicleNextServiceDate,
    a!save(ri!vehicle.vehicleLastModifiedBy,now())
    },
    submit: true,
    style: "PRIMARY"
    )
    },
    secondaryButtons: {
    a!buttonWidget(
    label: "Cancel",
    value: true,
    saveInto: ri!cancel,
    submit: true,
    style: "NORMAL",
    validate: false
    )
    },
    showWhen: or(
    isnull(
    ri!readOnly
    ),
    not(
    ri!readOnly
    )
    )
    )
    )

    This is my interface

Reply
  • a!formLayout(
    label: "Add Vehicle to Fleet",
    contents: {
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!textField(
    label: "Vehicle Make",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleMake,
    saveInto: ri!vehicle.vehicleMake,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleMake
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleMake
    ) & " characters.",
    null
    )
    ),
    a!paragraphField(
    label: "Vehicle Condition",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleCategory,
    saveInto: ri!vehicle.vehicleCategory,
    required: true,
    requiredMessage: "ri!vehicle.mileage > 500",
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleCategory
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleCategory
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle VIN",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleVIN,
    saveInto: ri!vehicle.vehicleVIN,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleVIN
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleVIN
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Status",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: "Initiated",
    saveInto: ri!vehicle.vehicleStatus,
    showWhen: true,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleStatus
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleStatus
    ) & " characters.",
    null
    )
    ),
    a!dateField(
    label: "Vehicle Last Modified By",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleLastModifiedBy,
    saveInto: ri!vehicle.vehicleLastModifiedBy,
    readOnly: ri!readOnly
    ),
    a!dateField(
    label: "Vehicle Added By",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleAddedBy,
    saveInto: ri!vehicle.vehicleAddedBy,
    readOnly: ri!readOnly
    ),
    a!columnsLayout(
    columns: {
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle Photos",

    labelPosition: "ABOVE",
    target: cons!SG_vehicle_photos,

    value: ri!vehicle.vehiclePhotos,
    saveInto: ri!vehicle.vehiclePhotos,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), { "PNG", "JPG" ,"JPEG"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be images. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle insurance number",
    labelPosition: "ABOVE",
    target: cons!SG_Insurance_Document,

    value: ri!vehicle.vehicleInsurancenumber,
    saveInto: ri!vehicle.vehicleInsurancenumber,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), {"PDF"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be PDF. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )

    )
    }
    ),
    a!columnLayout(
    contents: {
    a!fileUploadField(
    label: "vehicle ownersID proof",
    labelPosition: "ABOVE",
    target: cons!SG_ID_PROOF,

    value: ri!vehicle.ownersIDProof,
    saveInto: ri!vehicle.ownersIDProof,
    showWhen: if(ri!vehicle.vehicleCategory = cons!SG_VEHICLE_CATEGORIES[2],true(),false()),
    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), {"PDF"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be PDF. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    }
    )
    }
    ),
    a!dateTimeField(
    label: "Vehicle Last Maintenance Date",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleLastMaintenanceDate,
    saveInto: ri!vehicle.vehicleLastMaintenanceDate,
    readOnly: ri!readOnly
    )
    }
    ),
    a!columnLayout(
    contents: {
    a!textField(
    label: "Vehicle Model",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleModel,
    saveInto: ri!vehicle.vehicleModel,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleModel
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleModel
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Colour",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleColour,
    saveInto: ri!vehicle.vehicleColour,
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleColour
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleColour
    ) & " characters.",
    null
    )
    ),
    a!textField(
    label: "Vehicle Condition",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleCondition,
    saveInto: ri!vehicle.vehicleCondition,
    showWhen: ri!readOnly = true(),
    readOnly: ri!readOnly,
    validations: if(
    len(
    ri!vehicle.vehicleCondition
    ) > 255,
    "Value may not be longer than 255 characters. You have entered " & len(
    ri!vehicle.vehicleCondition
    ) & " characters.",
    null
    )
    ),
    a!integerField(
    label: "Vehicle Year",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleYear,
    saveInto: ri!vehicle.vehicleYear,
    readOnly: ri!readOnly
    ),
    a!integerField(
    label: "Vehicle Mileage",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleMileage,
    saveInto: ri!vehicle.vehicleMileage,
    readOnly: ri!readOnly
    ),
    a!dropdownField(
    label: "Category",
    labelPosition: "ABOVE",
    placeholderLabel: "upload related documents by selecting applicable category",
    choiceLabels: cons!SG_VEHICLE_CATEGORIES,
    choiceValues: cons!SG_VEHICLE_CATEGORIES,
    value: ri!vehicle.vehicleCategory,
    saveInto: ri!vehicle.vehicleCategory,
    showWhen: or(
    isnull(ri!readOnly),
    ri!readOnly=false()
    ),
    validations: {}
    ),
    a!dateField(
    label: "Vehicle Date Added",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleDateAdded,
    saveInto: ri!vehicle.vehicleDateAdded,
    readOnly: ri!readOnly
    ),
    a!dateTimeField(
    label: "Vehicle Next Maintenance Date",
    labelPosition: if(
    ri!readOnly,
    "ADJACENT",
    "ABOVE"
    ),
    value: ri!vehicle.vehicleNextMaintenanceDate,
    saveInto: ri!vehicle.vehicleNextMaintenanceDate,
    readOnly: ri!readOnly
    ),
    a!dateField(
    label: "",
    labelPosition: "ABOVE",
    saveInto: {},
    validations: {}
    ),
    a!dateField(
    label: "vehicleNextServiceDate",
    labelPosition: "ABOVE",
    value: ri!vehicle.vehicleNextServiceDate,
    saveInto: ri!vehicle.vehicleNextServiceDate,
    readOnly: false,
    validations: {}
    )
    }
    )
    }
    ),
    a!sideBySideLayout(
    items: {
    a!sideBySideItem(
    item: a!fileUploadField(
    label: "Rc document",
    labelPosition: "ABOVE",
    instructions: "only PNG or JPEG or JPG format applicable.",
    target: cons!SG_document_folder_pointer,

    value:ri!vehicle.vehicleRCNumber,
    saveInto:ri!vehicle.vehicleRCNumber,
    showWhen: if(ri!vehicle.vehicleCategory=cons!SG_VEHICLE_CATEGORIES[1],true(),false()),

    required: true,
    validations: a!localVariables(
    local!invalidExtensions: difference(upper(fv!files.extension), { "PNG", "JPG" ,"JPEG"}),
    if(
    length(local!invalidExtensions) > 0,
    "Attachments must be images. Remove: " &
    index(fv!files, "name", wherecontains(local!invalidExtensions, upper(fv!files.extension)), {}),
    ""
    )
    )
    )
    )
    }
    )
    },
    buttons: a!buttonLayout(
    primaryButtons: {
    a!buttonWidget(
    label: "Submit",
    value: if(
    isnull(ri!vehicle.vehicleLastModifiedBy), "",
    rule!VFM_CalculateNextServiceDate(
    ri!vehicle.vehicleCategory,
    ri!vehicle.vehicleLastModifiedBy
    )),
    saveInto: {ri!vehicle.vehicleNextServiceDate,
    a!save(ri!vehicle.vehicleLastModifiedBy,now())
    },
    submit: true,
    style: "PRIMARY"
    )
    },
    secondaryButtons: {
    a!buttonWidget(
    label: "Cancel",
    value: true,
    saveInto: ri!cancel,
    submit: true,
    style: "NORMAL",
    validate: false
    )
    },
    showWhen: or(
    isnull(
    ri!readOnly
    ),
    not(
    ri!readOnly
    )
    )
    )
    )

    This is my interface

Children