Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Function (Import from folio as trio)

This will import a function called overviewTableFunc.

  1. Copy the code

  2. Navigate to Folio → Launch and select the upload button towards the top left

  3. Toggle to “Enter text”

  4. Paste the code in the provided space

  5. Toggle to “Trio” format and select OK

Code Block
name:overviewTableFunc
mod:2017-08-01T20:00:36.728Z
func
id:@21136e63-ad1301d7 "overviewTableFunc"
src:
  (filter:"equip") => do
    equips: readAll(filter.parseFilter).sort("navName")
    rows: []
    cols: []
  
    equips.each x=> cols = cols.addAll(readAll(point and equipRef==x->id).colToList("navName"))
    cols = cols.unique.sort
    equips.each x=> do
      c: 1
      t: {label:true, name: x.dis}
      cols.each y=> do
        g: readAll(point and equipRef==x->id and navName==cols[c -1])
        if(g.size > 0) do
          g = g[0]
          t = t.set("val"+c+"Id","@"+g->id).set("val"+c+"Description",null)
          t = t.set("val"+c, if(g.has("curVal")) do
            if(g->curVal.isNumber) do
              u: g->curVal.unit
              if(u == null) g->curVal.finPrecision(2).toStr
              else g->curVal.finPrecision(2) + u
            end else g->curVal.toStr
          end else 0)
          t = t.set("val"+c+"Type", if(g.has("kind")) g->kind.lower else "")
        end
        c = c + 1
      end
      rows = rows.add(t)
    end
    cols = cols.map((x,y)=> do
      y = y + 1
      {label: x, property: "val"+y, rotate: true, type: "val"+y+"Type", id: "val"+y+"Id", description: "val"+y+"Description"}
    end)
    cols = cols.insert(0,{label: "", property: "label", rotate: "true", type: "label"})
    {data: {columns: cols, rows: rows}}
  end

Ractive setup

  • Drag Ractive out from components on the left side menu, and click on it to have the green outline

  • The green box can be resized to however small or large you would like your component

  • Under properties open the ractive editor, and copy and paste from the Ractive Code given above for template, model, style, and init

...