Show and Hide Fields in a Template

Certified Associate Developer

I've created an interface that shows and hides various fields based on the inputs in other fields. I'm now trying to make a document (preferably a PDF) that will display the data collected in the interface and ultimately be emailed to the customer. However it looks like the templates you have to make to use the "...Doc from Template" Smart Services are static and not capable of changing based on variables.

Does anyone have an idea on how to create a dynamic template that can change based on your data? I've thought about using PHP code inside of a HTML document but I'm not sure if/how that will work.

I've attached pictures of one of the dynamic aspects of my interface as well as the code associated with it.

a!multipleDropdownField(
                    label: if(
                      or(
                        ri!SealModel = "DRC",
                        ri!SealModel = "DTP",
                        ri!SealModel = "DRP",
                        ri!SealModel = "SMD",
                        ri!SealModel = "DGS",
                        ri!SealModel = "EDP",
                        ri!SealModel = "RBD",
                        ri!SealModel = "ESD",
                        ri!SealModel = "UMC",
                        ri!SealModel = "PRO",
                        ri!SealModel = "PDM",
                        ri!SealModel = "KMS"
                      ),
                      "Inboard Rotary Face:",
                      "Rotary Face:"
                    ),
                    labelPosition: "ABOVE",
                    placeholder: "Choose symptoms",
                    choiceLabels: {
                      "Missing",
                      "Carbon Dusting",
                      "Chipped",
                      "Cracked",
                      "Broken",
                      "Corroded",
                      "Pitted",
                      "Eroded",
                      "Leached",
                      "Blistered",
                      "Heat Checked",
                      "Thermal Markings",
                      "Product Residue",
                      "Rubbed",
                      "Worn",
                      "Grooved",
                      "Heavily Damaged",
                      "Plugged",
                      "Dented"
                    },
                    choiceValues: {
                      "Missing",
                      "Carbon Dusting",
                      "Chipped",
                      "Cracked",
                      "Broken",
                      "Corroded",
                      "Pitted",
                      "Eroded",
                      "Leached",
                      "Blistered",
                      "Heat Checked",
                      "Thermal Markings",
                      "Product Residue",
                      "Rubbed",
                      "Worn",
                      "Grooved",
                      "Heavily Damaged",
                      "Plugged",
                      "Dented"
                    },
                    value: ri!IBRotFaceSym,
                    saveInto: ri!IBRotFaceSym,
                    searchDisplay: "AUTO",
                    validations: {}
                  )
                )
              },
              alignVertical: "MIDDLE"
            ),
            /* IB Rotary Face */
            a!forEach(
              ri!IBRotFaceSym,
              a!localVariables(
                local!numarray: { 1 },
                local!Label: fv!item,
                a!forEach(
                  local!numarray,
                  a!localVariables(
                    local!Sev,
                    local!Loc,
                    local!Pic,
                    local!num: index(local!numarray, length(local!numarray)),
                    a!columnsLayout(
                      columns: {
                        a!columnLayout(
                          contents: {
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!dropdownField(
                                    label: local!Label & " Severity",
                                    labelPosition: "ADJACENT",
                                    placeholder: "--- Select a Value ---",
                                    choiceLabels: {
                                      "N/A",
                                      "Light",
                                      "Moderate",
                                      "Heavy",
                                      "Extreme"
                                    },
                                    choiceValues: {
                                      "N/A",
                                      "Light",
                                      "Moderate",
                                      "Heavy",
                                      "Extreme"
                                    },
                                    value: local!Sev,
                                    saveInto: { local!Sev },
                                    validations: {}
                                  )
                                ),
                                a!sideBySideItem(
                                  item: a!dropdownField(
                                    label: local!Label & " Location",
                                    labelPosition: "ADJACENT",
                                    placeholder: "--- Select a Value ---",
                                    choiceLabels: {
                                      "N/A",
                                      "ID",
                                      "OD",
                                      "Face",
                                      "Face ID",
                                      "Face OD",
                                      "Pin Slot",
                                      "Multiple Locations"
                                    },
                                    choiceValues: {
                                      "N/A",
                                      "ID",
                                      "OD",
                                      "Face",
                                      "Face ID",
                                      "Face OD",
                                      "Pin Slot",
                                      "Multiple Locations"
                                    },
                                    value: local!Loc,
                                    saveInto: { local!Loc },
                                    searchDisplay: "AUTO",
                                    validations: {}
                                  )
                                ),
                                a!sideBySideItem(
                                  item: a!fileUploadField(
                                    label: "Upload Photos",
                                    labelPosition: "ADJACENT",
                                    target: cons!IBRotFacePics,
                                    fileNames: ri!ControlNumber & " IB Rotary Face " & local!Label & " " & fv!index,
                                    value: local!Pic,
                                    saveInto: local!Pic,
                                    validations: {},
                                    buttonStyle: "SECONDARY"
                                  ),
                                  width: "MINIMIZE"
                                )
                              }
                            ),
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!linkField(
                                    links: {
                                      a!dynamicLink(
                                        label: "Add Location",
                                        value: append(local!numarray, local!num + 1),
                                        saveInto: local!numarray,
                                        showWhen: if(
                                          local!numarray[length(local!numarray)] =< fv!item,
                                          true(),
                                          false()
                                        )
                                      )
                                    }
                                  ),
                                  width: "MINIMIZE"
                                ),
                                a!sideBySideItem(
                                  item: a!linkField(
                                    links: {
                                      a!dynamicLink(
                                        label: "Remove Location",
                                        value: remove(local!numarray, fv!index),
                                        saveInto: local!numarray
                                      )
                                    }
                                  ),
                                  width: "MINIMIZE"
                                )
                              }
                            )
                          }
                        )
                      }
                    )
                  )
                )
              )
            ),

  Discussion posts and replies are publicly visible