OFBiz
  1. OFBiz
  2. OFBIZ-4379

Get first from list tag in screen's and form's action tag.

    Details

    • Type: New Feature New Feature
    • Status: Patch Available
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: Trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None
    • Sprint:
      Bug Crush Event - 21/2/2015

      Description

      In most of the cases we need to get first record from a list in screen and form widgets then we have to do something like this:
      for eg:
      <set field="websiteContent" value="$

      {groovy: org.ofbiz.entity.util.EntityUtil.getFirst(websiteContentList);}

      "/>

      Instead of using like this my idea is to add a tag like <first-from-list/> in Screen & Form widget's action tag, so one can easily get first record from a list.

        Activity

        Hide
        David E. Jones added a comment -

        Why not just use the [] syntax to get the first element? In other words, something like:

        <set field="websiteContent" from-field="websiteContentList[0]"/>

        Show
        David E. Jones added a comment - Why not just use the [] syntax to get the first element? In other words, something like: <set field="websiteContent" from-field="websiteContentList [0] "/>
        Hide
        Ankit Jain added a comment -

        Attaching patch for this feature.

        Show
        Ankit Jain added a comment - Attaching patch for this feature.
        Hide
        Ankit Jain added a comment -

        Hello David,

        I agree with what you say, and yes we can use your suggested way, but this tag is also present in the services, so a point came in my mind why we can't use the same tag in screens and forms. That's why created a patch for it.

        HTH

        Show
        Ankit Jain added a comment - Hello David, I agree with what you say, and yes we can use your suggested way, but this tag is also present in the services, so a point came in my mind why we can't use the same tag in screens and forms. That's why created a patch for it. HTH

          People

          • Assignee:
            Unassigned
            Reporter:
            Ankit Jain
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Development

                Agile