Inserting a new row into a table

Good Morning Guys,

How would one create an action to insert a row into a table.

I have a Table view that has quick edits enabled and have the ability to add, edit, and delete rows.

Problem is, if there is a row that needs to be inserted 5 down, currantly the user needs to delete everything up and too the 5th row, and redo the rest. Looking for a way to select a row and insert row above/below.

Any help would be appreciated

Thanks,

Solved Solved
0 12 1,718
1 ACCEPTED SOLUTION

Sample app

Data >> Columns

Details...

rows[sequence]

  • Type: Number
  • Require: ON
  • Initial value: (max(rows[sequence]) + 1)

Behavior >> Actions

Details...

increment sequence of this row (hidden)

  • For a record of this table: rows
  • Do this: Data: set the values of some columns in this row
  • Set these columns:
    • sequence: ([sequence] + 1)
  • Prominence: Do not display

move up rows at this sequence (hidden)

  • For a record of this table: rows
  • Do this: Data: execute an action on a set of rows
  • Referenced Table: rows
  • Referenced Rows:
    orderby(
      filter(
        "rows",
        ([_thisrow].[sequence] = [sequence])
      ),
      [_rownumber],
        true
    )
    
  • Referenced Action: increment sequence of this row (hidden)
  • Prominence: Do not display

move up other rows at this sequence (hidden)

  • For a record of this table: rows
  • Do this: Data: execute an action on a set of rows
  • Referenced Table: rows
  • Referenced Rows:
    (
      orderby(
        filter(
          "rows",
          ([_thisrow].[sequence] = [sequence])
        ),
        [_rownumber],
          true
      )
      - list([_thisrow])
    )
    
  • Referenced Action: increment sequence of this row (hidden)
  • Prominence: Do not display

move up this sequence (hidden)

  • For a record of this table: rows
  • Do this: Grouped: execute a sequence of actions
  • Actions:
    • move up rows above this sequence (hidden)
    • move up rows at this sequence (hidden)
  • Prominence: Do not display

move up rows above this sequence (hidden)

  • For a record of this table: rows
  • Do this: Data: execute an action on a set of rows
  • Referenced Table: rows
  • Referenced Rows:
    top(
      orderby(
        filter(
          "rows",
          (([_thisrow].[sequence] + 1) = [sequence])
        ),
        [_rownumber],
          true
      ),
      1
    )
    
  • Referenced Action: move up this sequence (hidden)
  • Prominence: Do not display

insert this row (hidden)

  • For a record of this table: rows
  • Do this: Grouped: execute a sequence of actions
  • Actions:
    • move up rows above this sequence (hidden)
    • move up other rows at this sequence (hidden)
  • Only if this condition is true:
    isnotblank(
      filter(
        "rows",
        ([_thisrow].[sequence] = [sequence])
      )
      - list([_thisrow])
    )
    
  • Prominence: Do not display

insert new row before this row (inline)

  • For a record of this table: rows
  • Do this: App: go to another view within this app
  • Target:
    linktoform(
      "rows_Form",
      "sequence",
        (
          any(
            sort(
              select(
                rows[sequence],
                ([sequence] < [_thisrow].[sequence])
              ),
              true
            )
            + list([sequence] - 1)
          )
          + 1
        )
    )
    
  • Action icon: plus
  • Prominence: Display inline
  • Attach to column: sequence

UX >> Views

Details...

rows

  • For this data: rows
  • View type: table
  • Position: center
  • Sort by:
    • sequence (Ascending)
  • Column order:
    • sequence
    • name

rows_Form

  • For this data: rows
  • View type: form
  • Position: ref
  • Event Actions:
    • Form Saved: insert this row (hidden)

View solution in original post

12 REPLIES 12
Top Labels in this Space