Display Value from two tables in Interface

Hello All, I have 2 table, All fields from Table2 automatically populated from Table1  but if any changes made in Table2 fields the data should Display in Table2. Can Anyone help me with? Thanks in Advance

  Discussion posts and replies are publicly visible

Parents
  • Can you elaborate a bit more on the use case, along with the table structure?

  • Hello Shikha, Thankyou for Reply.

    Table1 is Parent table and Table2 is a Child with Parent to child(Cascade All ) Relationship

    Table1 is a Lead Table(User fills the form) with Details

    {

    Name, Email Id, Phone No, Address, Date From and Date To, Adults

    };

    After Submission Agent Manager receives full data which has to appear in Table2, I have used Milestone(Bar) Pattern in Interface.

    In 1st Milestone I am showing User Form with all Disabled fields.

    In 2nd Milestone I am showing Customer Details with Editable Fields. 

    {

    Name, Email id, Address and Phone Number

    },

    Now, Problem is If Manager wants to edit the Data in Customer Details in Milestone2 the new data should display in the particular field and the new data should save to the Customer table and if changes not made previous data should saved to the table.

    Can you help me to solve the issue

Reply
  • Hello Shikha, Thankyou for Reply.

    Table1 is Parent table and Table2 is a Child with Parent to child(Cascade All ) Relationship

    Table1 is a Lead Table(User fills the form) with Details

    {

    Name, Email Id, Phone No, Address, Date From and Date To, Adults

    };

    After Submission Agent Manager receives full data which has to appear in Table2, I have used Milestone(Bar) Pattern in Interface.

    In 1st Milestone I am showing User Form with all Disabled fields.

    In 2nd Milestone I am showing Customer Details with Editable Fields. 

    {

    Name, Email id, Address and Phone Number

    },

    Now, Problem is If Manager wants to edit the Data in Customer Details in Milestone2 the new data should display in the particular field and the new data should save to the Customer table and if changes not made previous data should saved to the table.

    Can you help me to solve the issue

Children
  • Are you writing the values to DB anywhere ? Can you please post the code here ? (insert -> insert code )

  • {
      a!localVariables(
        /* List of steps in the milestone bar */
        local!milestoneBarSteps: {"Lead Details", "Customer Details", "Booking Details", "Travel Info"},
        local!currentMilestoneBarStep: 1,
        {
          a!columnsLayout(
            columns: {
              a!forEach(
                items: local!milestoneBarSteps,
                expression: if(
                  /* Completed step */
                  fv!index < local!currentMilestoneBarStep,
                  a!columnLayout(
                    contents: {
                      a!cardLayout(
                        contents: {
                          a!sideBySideLayout(
                            items: {
                              a!sideBySideItem(
                                item: a!richTextDisplayField(
                                  labelPosition: "COLLAPSED",
                                  value: {
                                    a!richTextItem(
                                      text: {
                                        a!richTextIcon(
                                          icon: "check",
                                          altText: "Completed step"
                                        )
                                      },
                                      size: "MEDIUM",
                                      style: "STRONG"
                                    )
                                  },
                                  align: "CENTER"
                                ),
                                width: "MINIMIZE"
                              ),
                              a!sideBySideItem(
                                item: a!richTextDisplayField(
                                  labelPosition: "COLLAPSED",
                                  value: {
                                    a!richTextItem(
                                      text: upper(fv!item),
                                      size: "MEDIUM"
                                    )
                                  },
                                  align: "LEFT"
                                )
                              )
                            }
                          )
                        },
                        /* Link to go to selected step */
                        link: a!dynamicLink(
                          value: fv!index,
                          saveInto: local!currentMilestoneBarStep
                        ),
                        style: "ACCENT",
                        showBorder: false,
                        accessibilityText: "Completed step. Press space to view step."
                      )
                    }
                  ),
                  if(
                    /* Future step */
                    fv!index > local!currentMilestoneBarStep,
                    a!columnLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: fv!index,
                                        size: "MEDIUM",
                                        style:"STRONG"
                                      )
                                    },
                                    align: "CENTER"
                                  ),
                                  width: "MINIMIZE"
                                ),
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: upper(fv!item),
                                        size: "MEDIUM"
                                      )
                                    },
                                    align: "LEFT"
                                  )
                                )
                              }
                            )
                          },
                          height: "AUTO",
                          style: "#efefef",
                          marginBelow: "NONE",
                          showBorder: false,
                          accessibilityText: "Future step"
                        )
                      }
                    ),
                    /* Current step */
                    a!columnLayout(
                      contents: {
                        a!cardLayout(
                          contents: {
                            a!sideBySideLayout(
                              items: {
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: {
                                          a!richTextIcon(
                                            icon: "hand-o-right",
                                            altText: "Current step",
                                            size: "MEDIUM"
                                          )
                                        },
                                        size: "MEDIUM",
                                        style: "STRONG"
                                      )
                                    },
                                    align: "CENTER"
                                  ),
                                  width: "MINIMIZE"
                                ),
                                a!sideBySideItem(
                                  item: a!richTextDisplayField(
                                    labelPosition: "COLLAPSED",
                                    value: {
                                      a!richTextItem(
                                        text: upper(fv!item),
                                        size: "MEDIUM",
                                        style: "STRONG"
                                      )
                                    },
                                    align: "LEFT"
                                  )
                                )
                              }
                            )
                          },
                          style: "ACCENT",
                          showBorder: false,
                          accessibilityText: "Current step"
                        )
                      }
                    )
                  )
                )
              )
            },
            spacing: "DENSE",
            stackWhen: {"PHONE","TABLET_PORTRAIT"}
          ),
          choose(
            local!currentMilestoneBarStep,
            {
              /* Replace this rich text with the component or rule that should populate this step */
              a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {a!richTextItem(text: "The contents of the first step belong here", style: "EMPHASIS")},
                align: "CENTER"
              ),
              a!boxLayout(
                label: "LEAD DETAILS",
                contents: {
                  a!columnsLayout(
                    columns: {
                      a!columnLayout(
                        contents: {
                          a!textField(
                            label: "Name",
                            labelPosition: "ABOVE",
                            value: ri!lead.name,
                            saveInto: ri!lead.name,
                            refreshAfter: "UNFOCUS",
                            readOnly: false,
                            disabled: false,
                            validations: {}
                          ),
                          a!textField(
                            label: "Phone Number",
                            labelPosition: "ABOVE",
                            value: ri!lead.phoneNo,
                            saveInto: ri!lead.phoneNo,
                            refreshAfter: "UNFOCUS",
                            disabled: false,
                            validations: if(
                              len(
                                ri!lead.phoneNo
                              ) > 10,
                              "Value may not be longer than 10 characters. You have entered " & len(
                                ri!lead.phoneNo
                              ) & " characters.",
                              null
                            )
                          ),
                          a!textField(
                            label: "Email",
                            labelPosition: "ABOVE",
                            value: ri!lead.email,
                            saveInto: ri!lead.email,
                            refreshAfter: "UNFOCUS",
                            disabled: false,
                            validations: if(
                              or(
                                isnull(trim(ri!lead.email)),
                                len(trim(ri!lead.email)) > 255,
                                length(split(trim(ri!lead.email), " ")) > 1,
                                count(split(ri!lead.email, "@")) <> 2
                              ),
                              "Invalid Email Address",
    
                              with(
                                localPart: split(trim(ri!lead.email),"@")[1],
                                domainPart: split(trim(ri!lead.email),"@")[2],
    
                                if(
                                  or(
                                    length(split(domainPart, ".")) < 2,
                                    contains(split(localPart, "."), ""),
                                    contains(split(domainPart, "."), ""),
                                    not(isnull(stripwith(lower(domainPart), "abcdefghijklmnopqrstuvwxyz1234567890-."))),
                                    not(isnull(stripwith(lower(localPart), "abcdefghijklmnopqrstuvwxyz1234567890-._+'&%")))
                                  ),
    
                                  "Invalid Email Address",
    
                                  ""
    
                                )
                              )
                            )
                          ),
                          a!paragraphField(
                            label: "Address",
                            labelPosition: "ABOVE",
                            value: ri!lead.address,
                            saveInto: ri!lead.address,
                            refreshAfter: "UNFOCUS",
                            height: "MEDIUM",
                            disabled: false,
                            validations: {}
                          )
                        }
                      ),
                      a!columnLayout(
                        contents: {
                          a!dateField(
                            label: "Date",
                            labelPosition: "ABOVE",
                            value: ri!lead.date,
                            saveInto: ri!lead.date,
                            disabled: false,
                            validations: {}
                          ),
                          a!textField(
                            label: "Destination",
                            labelPosition: "ABOVE",
                            value: ri!lead.destination,
                            saveInto: ri!lead.destination,
                            refreshAfter: "UNFOCUS",
                            disabled: false,
                            validations: {}
                          ),
                          a!sideBySideLayout(
                            items: {
                              a!sideBySideItem(
                                item: a!dateField(
                                  label: "Date From",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.date_from,
                                  saveInto: ri!lead.date_from,
                                  disabled: false,
                                  validations: {}
                                )
                              ),
                              a!sideBySideItem(
                                item: a!dateField(
                                  label: "Date To",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.date_to,
                                  saveInto: ri!lead.date_to,
                                  disabled: false,
                                  validations: {}
                                )
                              )
                            }
                          ),
                          a!sideBySideLayout(
                            items: {
                              a!sideBySideItem(
                                item: a!integerField(
                                  label: "No of Adults",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.adults,
                                  saveInto: ri!lead.adults,
                                  refreshAfter: "UNFOCUS",
                                  disabled: false,
                                  validations: {}
                                )
                              ),
                              a!sideBySideItem(
                                item: a!integerField(
                                  label: "No of Kids",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.kids,
                                  saveInto: ri!lead.kids,
                                  refreshAfter: "UNFOCUS",
                                  disabled: false,
                                  validations: {}
                                )
                              )
                            }
                          ),
                          a!paragraphField(
                            label: "Aditional Details",
                            labelPosition: "ABOVE",
                            value: ri!lead.comments,
                            saveInto: ri!lead.comments,
                            refreshAfter: "UNFOCUS",
                            height: "MEDIUM",
                            disabled: false,
                            validations: {}
                          )
                        }
                      )
                    }
                  )
                },
                style: "STANDARD",
                marginBelow: "STANDARD"
              )
            },
            {
              /* Replace this rich text with the component or rule that should populate this step */
              a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {a!richTextItem(text: "The contents of the second step belong here", style: "EMPHASIS")},
                align: "CENTER"
              ),
              a!boxLayout(
                label: "CUSTOMER DETAILS",
                contents: {
                  a!columnsLayout(
                    columns: {
                      a!columnLayout(
                        contents: {
                          a!textField(
                            label: "Name",
                            labelPosition: "ABOVE",
                            value: if(len(ri!lead.name)>(ri!CTA_Booking.customer.name), (ri!CTA_Booking.customer.name & ri!lead.name), ri!CTA_Booking.customer.name),
                            saveInto: ri!CTA_Booking.customer.name,
    
    
                            refreshAfter: "UNFOCUS",
    
                            masked: false
                          ),
                          a!textField(
                            label: "Address",
                            labelPosition: "ABOVE",
                            value:  if(len(ri!lead.address)>(ri!CTA_Booking.customer.address), (ri!CTA_Booking.customer.address & ri!lead.address), ri!CTA_Booking.customer.address),
                            saveInto: ri!CTA_Booking.customer.address,
    
                            refreshAfter: "UNFOCUS",
    
                            validations: {}
                          )
                        }
                      ),
                      a!columnLayout(
                        contents: {
                          a!textField(
                            label: "Phone Number",
                            labelPosition: "ABOVE",
                            value:  if(len(ri!lead.phoneNo)>(ri!CTA_Booking.customer.phoneNo), (ri!CTA_Booking.customer.phoneNo & ri!lead.phoneNo), ri!CTA_Booking.customer.phoneNo),
                            saveInto: ri!CTA_Booking.customer.phoneNo,
    
                            validations: if(
                              len(
                                ri!lead.phoneNo
                              ) > 10,
                              "Value may not be longer than 10 characters. You have entered " & len(
                                ri!lead.phoneNo
                              ) & " characters.",
                              null
                            )
                          ),
                          a!textField(
                            label: "Email Address",
                            labelPosition: "ABOVE",
                            value:  if(len(ri!lead.email)>(ri!CTA_Booking.customer.email), (ri!CTA_Booking.customer.email & ri!lead.email), ri!CTA_Booking.customer.email),
                            saveInto: ri!CTA_Booking.customer.email,
                            refreshAfter: "UNFOCUS",
    
                            validations: if(
                              or(
                                isnull(trim(ri!lead.email)),
                                len(trim(ri!lead.email)) > 255,
                                length(split(trim(ri!lead.email), " ")) > 1,
                                count(split(ri!lead.email, "@")) <> 2
                              ),
                              "Invalid Email Address",
    
                              with(
                                localPart: split(trim(ri!lead.email),"@")[1],
                                domainPart: split(trim(ri!lead.email),"@")[2],
    
                                if(
                                  or(
                                    length(split(domainPart, ".")) < 2,
                                    contains(split(localPart, "."), ""),
                                    contains(split(domainPart, "."), ""),
                                    not(isnull(stripwith(lower(domainPart), "abcdefghijklmnopqrstuvwxyz1234567890-."))),
                                    not(isnull(stripwith(lower(localPart), "abcdefghijklmnopqrstuvwxyz1234567890-._+'&%")))
                                  ),
    
                                  "Invalid Email Address",
    
                                  ""
    
                                )
                              )
                            )
    
                          )
                        }
                      )
                    }
                  )
                },
                style: "STANDARD",
                marginBelow: "STANDARD"
              )
            },
            {
              /* Replace this rich text with the component or rule that should populate this step */
              a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {a!richTextItem(text: "The contents of the third step belong here", style: "EMPHASIS")},
                align: "CENTER"
              ),
              a!boxLayout(
                label: "BILLING DETAILS",
                contents: {
                  a!columnsLayout(
                    columns: {
                      a!columnLayout(
                        contents: {
                          a!dateField(
                            label: "Date",
                            labelPosition: "ABOVE",
                            value: if(isnull(ri!CTA_Booking.date),today(),ri!CTA_Booking.date),
                            saveInto: ri!CTA_Booking.date,
    
                            readOnly: false,
                            disabled: true
                          ),
                          a!dropdownField(
                            label: "Status",
                            labelPosition: "ABOVE",
                            placeholder: "--- Select a Value ---",
                            choiceLabels: cons!CTA_BookingStatus,
                            choiceValues: cons!CTA_BookingStatus,
                            value: ri!CTA_Booking.status,
                            saveInto: ri!CTA_Booking.status,
                            searchDisplay: "AUTO",
                            disabled: false,
                            validations: {}
                          ),
                          a!textField(
                            label: "Created By",
                            labelPosition: "ABOVE",
                            value: loggedinuser(),
                            saveInto: ri!lead.name,
                            refreshAfter: "UNFOCUS",
                            showWhen: false(),
                            disabled: true,
                            masked: false,
                            validations: {}
                          )
                        }
                      ),
                      a!columnLayout(
                        contents: {
                          a!floatingPointField(
                            label: "Hotel Cost",
                            labelPosition: "ABOVE",
                            value: ri!CTA_Booking.hotelCost,
                            saveInto: ri!CTA_Booking.hotelCost,
                            refreshAfter: "KEYPRESS",
                            validations: {}
                          ),
                          a!floatingPointField(
                            label: "Travel Cost",
                            labelPosition: "ABOVE",
                            value: ri!CTA_Booking.travelCost,
                            saveInto: ri!CTA_Booking.travelCost,
                            refreshAfter: "KEYPRESS",
                            validations: {}
                          ),
                          a!floatingPointField(
                            label: "Additional Cost",
                            labelPosition: "ABOVE",
                            value: ri!CTA_Booking.additionalCost,
                            saveInto: ri!CTA_Booking.additionalCost,
                            refreshAfter: "KEYPRESS",
                            validations: {}
                          ),
                          a!floatingPointField(
                            label: "Total Cost",
                            labelPosition: "ABOVE",
                            value: if(
                              or(
                                isnull(
                                  ri!CTA_Booking.hotelCost
                                ),
                                isnull(
                                  ri!CTA_Booking.travelCost
                                ),
                                isnull(
                                  ri!CTA_Booking.additionalCost
                                )
                              ),
                              0,
                              sum(ri!CTA_Booking.hotelCost, ri!CTA_Booking.travelCost,ri!CTA_Booking.additionalCost)  
    
    
                            ),
                            saveInto: ri!totalCost,
                            refreshAfter: "KEYPRESS",
                            disabled: true,
                            validations: {}
                          )
                        }
                      )
                    }
                  )
                },
                style: "STANDARD",
                marginBelow: "STANDARD"
              )
            },
            {
              /* Replace this rich text with the component or rule that should populate this step */
              a!richTextDisplayField(
                labelPosition: "COLLAPSED",
                value: {a!richTextItem(text: "The contents of the fourth step belong here", style: "EMPHASIS")},
                align: "CENTER"
              ),
              a!boxLayout(
                label: "TRAVEL INFO",
                contents: {
                  a!columnsLayout(
                    columns: {
                      a!columnLayout(
                        contents: {
                          a!textField(
                            label: "Destination",
                            labelPosition: "ABOVE",
                            value:  if(len(ri!lead.destination)>(ri!CTA_Booking.travelInfo.destination), (ri!CTA_Booking.travelInfo.destination & ri!lead.destination), ri!CTA_Booking.travelInfo.destination),
                            saveInto: ri!CTA_Booking.travelInfo.destination,
    
                            refreshAfter: "UNFOCUS",
    
                            disabled: false,
                            validations: {}
                          ),
                          a!sideBySideLayout(
                            items: {
                              a!sideBySideItem(
                                item: a!dateField(
                                  label: "Date From",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.date_from,
                                  /*value: if(len(ri!lead.date_from)>(ri!CTA_Booking.travelInfo.dateFrom), (ri!CTA_Booking.travelInfo.dateFrom & ri!lead.date_from), ri!CTA_Booking.travelInfo.dateFrom),*/
                                  saveInto: ri!CTA_Booking.travelInfo.dateFrom,
    
                                  disabled: false,
                                  validations: {}
                                )
                              ),
                              a!sideBySideItem(
                                item: a!dateField(
                                  label: "Date To",
                                  labelPosition: "ABOVE",
                                  value: ri!lead.date_to,
                                  /*value: if(len(ri!lead.date_to)>(ri!CTA_Booking.travelInfo.dateTo), (ri!CTA_Booking.travelInfo.dateTo & ri!lead.date_to), ri!CTA_Booking.travelInfo.dateTo),*/
                                  saveInto: ri!CTA_Booking.travelInfo.dateTo,
    
    
                                  disabled: false,
                                  validations: {}
                                )
                              )
                            }
                          )
                        }
                      ),
                      a!columnLayout(
                        contents: {
                          a!integerField(
                            label: "Adults",
                            labelPosition: "ABOVE",
                            value: if(len(ri!lead.adults)>(ri!CTA_Booking.travelInfo.adults), (ri!CTA_Booking.travelInfo.adults & ri!lead.adults), ri!CTA_Booking.travelInfo.adults),
                            saveInto: ri!CTA_Booking.travelInfo.adults,
                            refreshAfter: "UNFOCUS",
    
                            disabled: false,
                            validations: {}
                          ),
                          a!integerField(
                            label: "Kids",
                            labelPosition: "ABOVE",
                            value: if(len(ri!lead.kids)>(ri!CTA_Booking.travelInfo.kids), (ri!CTA_Booking.travelInfo.kids & ri!lead.kids), ri!CTA_Booking.travelInfo.kids),
                            saveInto: ri!CTA_Booking.travelInfo.kids,
                            refreshAfter: "UNFOCUS",
    
                            disabled: false,
                            validations: {}
                          )
                        }
                      )
                    }
                  )
                },
                style: "STANDARD",
                marginBelow: "STANDARD"
              )
            }
          ),
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: {
                      a!buttonWidget(
                        label: "Back",
                        value: local!currentMilestoneBarStep - 1,
                        saveInto: local!currentMilestoneBarStep,
                        style: "NORMAL",
                        showWhen: local!currentMilestoneBarStep > 1
                      ),
                      a!buttonWidget(
                        label: "Cancel",
                        style: if(
                          local!currentMilestoneBarStep = 1,
                          "NORMAL",
                          "LINK"
                        )
                      )
                    },
                    align: "START"
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!buttonArrayLayout(
                    buttons: a!buttonWidget(
                      label: if(
                        local!currentMilestoneBarStep = length(local!milestoneBarSteps),
                        "Submit",
                        "Next"
                      ),
                      saveInto: if(
                        local!currentMilestoneBarStep = length(local!milestoneBarSteps),
                        {},
                        a!save(
                          local!currentMilestoneBarStep,
                          local!currentMilestoneBarStep + 1
                        )
                      ),
                      submit: if(
                        local!currentMilestoneBarStep = length(local!milestoneBarSteps=4),
                        true,
                        false
                      ),
                      style: "PRIMARY",
                      validate: true
                    )
                  )
                }
              )
            }
          )
        }
      )
    }

  • Hello Raghuveer,

    First of all you have to convert your local variable into rule input  using save into function , then you can pass this rule input to your process model as variable , using script task you can pass these process variable to write to data store entity with updated values