Skip to content

lib-finNHaystackExt 库参考 ​

原文: https://finproducts.atlassian.net/wiki/spaces/JIDD3/pages/34793914561/FIN+5.3.1+lib-finNHaystackExt 中文整理基于 FIN 5.3.1

导读: 本页为 lib-finNHaystackExt 的 API / 标签 / 函数参考文档。

以下为 API 参考,保留英文以便对照源码;目录已列出(英文标题便于检索);概述已尽量中译。


目录(导读) ​

  • lib
  • meta
  • funcs
  • def
  • finAddFloorToEquipCommit(items, floor, suffix)
  • finCommitNHaystackApplyBatchTags(items, tags)
  • finFormNHaystackApplyBatchTags(id, selectedDicts)
  • finFormNHaystackMapPointsToEquip(id, selectedDicts)
  • finNHaystackAddEquips(conn, targetFilter, siteName, ids: [,])
  • finNHaystackAddFloorToEquip(id, selectedDicts)
  • finNHaystackAddHaystackSlots(conn, targetFilter, ids: [,])
  • finNHaystackAdvancedApplyBatchTagsCommit(connId, targetFilter, tags, searchTag, searchFunction, searchValue)
  • finNHaystackApplyAddEquips(id, targetFilter, siteName, ids: [])
  • finNHaystackApplyBatchTags(conn, targetFilter, tags, ids: [,], returnResultRows: false)
  • finNHaystackApplyFolioFilter(conn, filter)
  • finNHaystackCopyEquipTags(conn, fromEquip, targetFilter, toEquips: [,])
  • finNHaystackDelete(conn, ids)
  • finNHaystackDeleteHaystackSlot(conn, ids)
  • finNHaystackFindDuplicatePoints(conn)
  • finNHaystackFormAddEquips(id, selectedDicts: null)
  • finNHaystackFormAddHaystackSlots(id, selectedDicts: null)
  • finNHaystackFormAdvancedApplyBatchTags(id, selectedDicts: null)
  • finNHaystackFormApplyBatchTags(id, selectedDicts: null)
  • finNHaystackFormCopyEquipTags(id, selectedDicts: null)
  • finNHaystackFormDelete(id, selectedDicts: null)
  • finNHaystackFormDeleteHaystackSlot(id, selectedDicts: null)
  • finNHaystackFormPriorityArray(id)
  • finNHaystackFormRebuildCache(id)
  • finNHaystackFormSyncEquips(id)
  • finNHaystackInvoke(id, action, args: null)
  • finNHaystackMapPointsToEquip(conn, siteNavName, equipNavName, ids)
  • finNHaystackMapPointsToEquipApply(items, site, equip)
  • finNHaystackPointWriteArray(conn, id)
  • finNHaystackPullPropTags(conn, tags, filter, ids: [,])
  • finNHaystackPullPropsForm(id, selectedDicts: null)
  • finNHaystackQuery(id, selectedIds)
  • finNHaystackReadSize(conn, filter)
  • finNHaystackReadUnique(conn, filter, column)
  • finNHaystackRebuildCache(conn)
  • finNHaystackRemoveBrokenRefs(haystackConn)
  • finNHaystackSearchAndReplace(conn, filter, searchText, replaceText, ids: [,])
  • finNHaystackShowPointsInWatch(conn, watchId)
  • finNHaystackShowWatches(conn)
  • finNHaystackSyncNiagaraEquipApply(connFilter, targetFilter, updateNavName)
  • finNHaystackUniqueEquipTypes(haystackConn)
  • finNHaystackUniqueTags(conn, filter)
  • finNHaystackViewEquipTypesCommit(connId, tagsToApply)
  • finNHaystackViewEquipTypesForm(id, selectedDicts: null)
  • finToAlarm(params)
  • finToNormal(params)
  • nHaystackQueryApply(connFilter, filter, tag, option, needle)

概述(中译) ​

FIN NHaystack


API 正文(英文) ​

funcs ​

finAddFloorToEquipCommitAxon function
finCommitNHaystackApplyBatchTagsAxon function
finFormNHaystackApplyBatchTagsAxon function
finFormNHaystackMapPointsToEquipAxon function
finNHaystackAddEquipsfinNHaystackAddEquips This method calls the addEquips op on nhaystack
finNHaystackAddFloorToEquipAxon function
finNHaystackAddHaystackSlotsfinNHaystackAddHaystackSlots This method calls the applyBatchTag op on nhaystack
finNHaystackAdvancedApplyBatchTagsCommitAxon function
finNHaystackApplyAddEquipsAxon function
finNHaystackApplyBatchTagsfinNHaystackApplyBatchTags This method calls the applyBatchTag op on nhaystack
finNHaystackApplyFolioFilterfinNHaystackApplyFolioFilter This method runs the given filter against the Folio database, and ships the grid down to nhaystack
finNHaystackCopyEquipTagsfinNHaystackCopyEquipTags
finNHaystackDeletefinNHaystackDelete
finNHaystackDeleteHaystackSlotfinNHaystackDeleteHaystackSlot
finNHaystackFindDuplicatePointsfinNHaystackFindDuplicatePoints
finNHaystackFormAddEquipsAxon function
finNHaystackFormAddHaystackSlotsAxon function
finNHaystackFormAdvancedApplyBatchTagsAxon function
finNHaystackFormApplyBatchTagsAxon function
finNHaystackFormCopyEquipTagsAxon function
finNHaystackFormDeleteAxon function
finNHaystackFormDeleteHaystackSlotAxon function
finNHaystackFormPriorityArrayAxon function
finNHaystackFormRebuildCacheAxon function
finNHaystackFormSyncEquipsAxon function
finNHaystackInvokeAxon function
finNHaystackMapPointsToEquipfinNHaystackMapPointsToEquip This method applies equipRef tags to a list of points, so that those points become children of the given equip
finNHaystackMapPointsToEquipApplyAxon function
finNHaystackPointWriteArrayfinNHaystackPointWriteArray
finNHaystackPullPropTagsfinNHaystackPullPropTags
finNHaystackPullPropsFormAxon function
finNHaystackQueryAxon function
finNHaystackReadSizefinNHaystackReadSize This method calls read with the given filter, and then counts the number of resulting recs
finNHaystackReadUniquefinNHaystackReadUnique This method calls read with the given filter, and then finds the unique values of the given column
finNHaystackRebuildCachefinNHaystackRebuildCache This method calls rebuildCache in NHaystack
finNHaystackRemoveBrokenRefsAxon function
finNHaystackSearchAndReplacefinNHaystackSearchAndReplace This method renames components by replacing searchText with replaceText
finNHaystackShowPointsInWatchfinNHaystackShowPointsInWatch
finNHaystackShowWatchesfinNHaystackShowWatches
finNHaystackSyncNiagaraEquipApplyAxon function
finNHaystackUniqueEquipTypesAxon function
finNHaystackUniqueTagsfinNHaystackUniqueTags
finNHaystackViewEquipTypesCommitAxon function
finNHaystackViewEquipTypesFormAxon function
finToAlarmfinToAlarm
finToNormalfinToNormal
nHaystackQueryApplyAxon function


def ​

func:finAddFloorToEquipCommit ​

finAddFloorToEquipCommit(items, floor, suffix) ​

Axon function


meta ​

deffunc:finAddFloorToEquipCommit
isfunc
liblib:finNHaystackExt
namefinAddFloorToEquipCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(items, floor,suffix)=>do
  if(items == "") return []
  mymap:{}
  items.each(p=> do
    connId:p.get("connRef")
    ar :[]
    if(mymap.has(connId.toStr))
      ar = mymap.get(connId.toStr)
    ar = ar.add(p)
    mymap = mymap.set(connId.toStr,ar)
  end)
  mymap.each((arr,conn)=>do
    connId:parseRef(conn)
    filter: "("+ arr.map(r=> "id==@"+r->id).concat(" or ") + ")"
    finNHaystackApplyBatchTags(connId,filter,"floorName:\""+floor + " " + suffix +"\"")
  end)
end


def ​

func:finCommitNHaystackApplyBatchTags ​

finCommitNHaystackApplyBatchTags(items, tags) ​

Axon function


meta ​

deffunc:finCommitNHaystackApplyBatchTags
isfunc
liblib:finNHaystackExt
namefinCommitNHaystackApplyBatchTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(items,tags) => do
  if(items == "") return []
  mymap:{}
  items.each(p=> do
    connId:p.get("connRef")
    ar :[]
    if(mymap.has(connId.toStr))
      ar = mymap.get(connId.toStr)
    ar = ar.add(p)
    mymap = mymap.set(connId.toStr,ar)
  end)
  mymap.each((arr,conn)=>do
    connId:parseRef(conn)
    filter: "("+ arr.map(r=> "id==@"+r->id).concat(" or ") + ")"
    finNHaystackApplyBatchTags(connId,filter,tags)
  end)
end


def ​

func:finFormNHaystackApplyBatchTags ​

finFormNHaystackApplyBatchTags(id, selectedDicts) ​

Axon function


meta ​

appFormOnoldFolio
deffunc:finFormNHaystackApplyBatchTags
distoLocale("finNHaystackExt::nHaystackApplyBatchTags")
finForm✓
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnaxType
isfunc
liblib:finNHaystackExt
namefinFormNHaystackApplyBatchTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts) => do
selectedIds:""
if(selectedDicts != null) do
  selectedIds = selectedDicts
end
body: [
{name: "tags", editorType: "textinput", prompt: toLocale("finNHaystackExt::enterListOfTagsToAddOrRemove"), encapsulate: true},
{name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
{name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
]
{ "dis": toLocale("finNHaystackExt::nHaystackBatchEditTags"),
"name": "nbatchEditTags",
"body": body.toJSON,
"cancelButton": "\$cancelButton",
"commitButton": "\$applyButton",
"commitAction": "finCommitNHaystackApplyBatchTags("+ selectedIds.toAxonCode +",\$tags)",
"finForm": marker(),
"helpDoc":"/wiki/display/FINStack/Nhaystack+Apply+Batch+Tags",
}.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finFormNHaystackMapPointsToEquip ​

finFormNHaystackMapPointsToEquip(id, selectedDicts) ​

Axon function


meta ​

appFormOnoldFolio
deffunc:finFormNHaystackMapPointsToEquip
distoLocale("finNHaystackExt::nHaystackMapPtsToEquip")
finForm✓
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnaxType and point
isfunc
liblib:finNHaystackExt
namefinFormNHaystackMapPointsToEquip

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts)=>do
  selectedIds:""
  if(selectedDicts != null) do
    selectedIds= selectedDicts
  end
  body:[
    {name:"site",editorType:"textinput",prompt:toLocale("j2FinToolsExt::siteName")},
    {name:"equip",editorType:"textinput",prompt:"Equip Name"},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  {
    "dis":toLocale("finNHaystackExt::mapPtsToEquip"),
    "name": "mapPointsToEquipForm",
    "body":body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "finNHaystackMapPointsToEquipApply("+selectedIds.toAxonCode + ",\$site,\$equip)" ,
    "finForm": marker(),
    "helpDoc":"/wiki/display/FINStack/Nhaystack+Map+Points+To+Equip",
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackAddEquips ​

finNHaystackAddEquips(conn, targetFilter, siteName, ids: [,]) ​

finNHaystackAddEquips This method calls the addEquips op on nhaystack. It uses the targetFilter to find recs, and then adds the equip


meta ​

constructfinNHaystackAddEquips(conn, targetFilter, siteName, ids)...
deffunc:finNHaystackAddEquips
examplefinNHaystackAddEquips(conn, "device", "mySite") This ex...
isfunc
liblib:finNHaystackExt
namefinNHaystackAddEquips

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackAddFloorToEquip ​

finNHaystackAddFloorToEquip(id, selectedDicts) ​

Axon function


meta ​

appFormOnoldFolio
deffunc:finNHaystackAddFloorToEquip
distoLocale("finNHaystackExt::nHaystackAddFloorToEquip")
finForm✓
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnaxType and equip
isfunc
liblib:finNHaystackExt
namefinNHaystackAddFloorToEquip

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts)=> do
  selectedIds:""
  if(selectedDicts != null) do
    selectedIds = selectedDicts
  end
  body:[
    {
      name: "namePrefix",
      editorType: "combobox",
      prompt: toLocale("finNHaystackExt::namePrefix"),
      selectedValueTags:"val",
      labelField:"dis",
      defIndex:0,
      dataProvider:[
        {val:toLocale("j2FinToolsExt::floor"),dis:toLocale("j2FinToolsExt::floor")},
        {val:toLocale("finNHaystackExt::basement"),dis:toLocale("finNHaystackExt::basement")},
        {val:toLocale("finNHaystackExt::groundFloor"),dis:toLocale("finNHaystackExt::groundFloor")},
        {val:toLocale("finNHaystackExt::mezzanine"),dis:toLocale("finNHaystackExt::mezzanine")},
        {val:toLocale("finNHaystackExt::roof"),dis:toLocale("finNHaystackExt::roof")},
        {val:toLocale("finNHaystackExt::utility"),dis:toLocale("finNHaystackExt::utility")},
        {val:"",dis:toLocale("finStackMobileExt::saveAsCustom")}
      ].toAxonCode
    },
    {name:"suffix", editorType:"textinput",defVal:"1",prompt:toLocale("finNHaystackExt::suffixName")},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  { "dis": toLocale("finNHaystackExt::addFloorToEquip"),
  "name": "addFloorToEquipForm",
  "body": body.toJSON,
  "cancelButton": "\$cancelButton",
  "commitButton": "\$applyButton",
  "commitAction": "finAddFloorToEquipCommit("+selectedIds.toAxonCode  + ",\$namePrefix,\$suffix)" ,
  "finForm": marker(),
  "helpDoc":"/wiki/display/FINStack/Nhaystack+Add+Floor+To+Equip",
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackAddHaystackSlots ​

finNHaystackAddHaystackSlots(conn, targetFilter, ids: [,]) ​

finNHaystackAddHaystackSlots This method calls the applyBatchTag op on nhaystack. It uses the targetFilter to find recs, and then adds or removes tags on those recs.


meta ​

constructfinNHaystackAddHaystackSlots(conn, targetFilter, ids?)
deffunc:finNHaystackAddHaystackSlots
examplefinNHaystackAddHaystackSlots(conn, "point") This exampl...
isfunc
liblib:finNHaystackExt
namefinNHaystackAddHaystackSlots

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackAdvancedApplyBatchTagsCommit ​

finNHaystackAdvancedApplyBatchTagsCommit(connId, targetFilter, tags, searchTag, searchFunction, searchValue) ​

Axon function


meta ​

deffunc:finNHaystackAdvancedApplyBatchTagsCommit
isfunc
liblib:finNHaystackExt
namefinNHaystackAdvancedApplyBatchTagsCommit

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(connId, targetFilter, tags, searchTag, searchFunction, searchValue) => do

  recs: haystackCall(connId, "read",{filter:targetFilter})

  ids: null
  if (searchFunction == "contains") do
    ids =  recs.findAll( row => if(row[searchTag].contains(searchValue) and not row->axType.contains("History")) true else false).toRecIdList()
  else if (searchFunction == "startsWith") do
    ids = recs.findAll( row => if(row[searchTag].startsWith(searchValue) and not row->axType.contains("History")) true else false).toRecIdList()
  else if (searchFunction == "endsWith") do
    ids = recs.findAll( row => if(row[searchTag].endsWith(searchValue) and not row->axType.contains("History")) true else false).toRecIdList()
  end

  if (ids.size == 0) do
    finFormAlertOk(
      toLocale("finNHaystackExt::noMatchingRecords"),
      toLocale("finNHaystackExt::noRecordsMatchQuery"))
  else do

    params:
      [ "@" + connId,
        toAxonCode(targetFilter),
        toAxonCode(tags),
        "[" + ids.map(id => id.toAxonCode).concat(",") + "]"
      ].concat(",")

    body: [
      {name: "label", editorType: "label", text: toLocale("finNHaystackExt::confirmEditRecords").replace("{number}", ids.size) },
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true}
    ]

    { "dis":toLocale("finNHaystackExt::confirmEdit"),
      "name": "foo",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackApplyBatchTags(" + params + ")",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:finNHaystackApplyAddEquips ​

finNHaystackApplyAddEquips(id, targetFilter, siteName, ids: []) ​

Axon function


meta ​

deffunc:finNHaystackApplyAddEquips
isfunc
liblib:finNHaystackExt
namefinNHaystackApplyAddEquips

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, targetFilter, siteName, ids: []) => do
  if (targetFilter != "")
      targetFilter = "device == \"" + targetFilter + "\""
  readById(id).finNHaystackAddEquips(targetFilter,siteName,ids)
end


def ​

func:finNHaystackApplyBatchTags ​

finNHaystackApplyBatchTags(conn, targetFilter, tags, ids: [,], returnResultRows: false) ​

finNHaystackApplyBatchTags This method calls the applyBatchTag op on nhaystack. It uses the targetFilter to find recs, and then adds or removes tags on those recs.


meta ​

constructfinNHaystackApplyBatchTags(conn, targetFilter, tags, ids...
deffunc:finNHaystackApplyBatchTags
examplefinNHaystackApplyBatchTags(@connId, "equip", "foo, -bar,...
isfunc
liblib:finNHaystackExt
namefinNHaystackApplyBatchTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackApplyFolioFilter ​

finNHaystackApplyFolioFilter(conn, filter) ​

finNHaystackApplyFolioFilter

This method runs the given filter against the Folio database, and ships the grid down to nhaystack. NHaystack takes the grid and applies the tags to each component, via the axSlotPath entry.

Tags which should not be written down to nhaystack are automatically stripped out.


meta ​

constructfinNHaystackApplyFolioFilter(conn, filter)
deffunc:finNHaystackApplyFolioFilter
examplefinNHaystackApplyFolioFilter(@connId, "point and equipRe...
isfunc
liblib:finNHaystackExt
namefinNHaystackApplyFolioFilter

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackCopyEquipTags ​

finNHaystackCopyEquipTags(conn, fromEquip, targetFilter, toEquips: [,]) ​

finNHaystackCopyEquipTags


meta ​

constructfinNHaystackCopyEquipTags(conn, fromEquip, toEquips)
deffunc:finNHaystackCopyEquipTags
isfunc
liblib:finNHaystackExt
namefinNHaystackCopyEquipTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackDelete ​

finNHaystackDelete(conn, ids) ​

finNHaystackDelete


meta ​

constructfinNHaystackDelete(conn, ids)
deffunc:finNHaystackDelete
isfunc
liblib:finNHaystackExt
namefinNHaystackDelete

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackDeleteHaystackSlot ​

finNHaystackDeleteHaystackSlot(conn, ids) ​

finNHaystackDeleteHaystackSlot


meta ​

constructfinNHaystackDeleteHaystackSlot(conn, ids)
deffunc:finNHaystackDeleteHaystackSlot
isfunc
liblib:finNHaystackExt
namefinNHaystackDeleteHaystackSlot

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackFindDuplicatePoints ​

finNHaystackFindDuplicatePoints(conn) ​

finNHaystackFindDuplicatePoints


meta ​

constructfinNHaystackFindDuplicatePoints(conn)
deffunc:finNHaystackFindDuplicatePoints
examplefinNHaystackFindDuplicatePoints(@connId) This example r...
isfunc
liblib:finNHaystackExt
namefinNHaystackFindDuplicatePoints

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackFormAddEquips ​

finNHaystackFormAddEquips(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormAddEquips
distoLocale("finStackMobileExt::addHaystackEquip")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will add Hastack Equip or multiple Equips to Niagar...
isfunc
liblib:finNHaystackExt
namefinNHaystackFormAddEquips

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do

    body: [
      {name: "deviceSelector", editorType: "combobox", prompt: toLocale("finNHaystackExt::selectDeviceType"),
        dataProvider: "readById(@" + id + ").finNHaystackReadUnique(\"device\", \"device\")",
        labelField: "device", selectedValueTags: "device", encapsulate: true},
      {name: "siteName", editorType: "textinput",prompt:toLocale("j2FinToolsExt::siteName"),
          toolTip:"This creates and/or references Equips to the site you enter in here"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    { "dis": toLocale("finNHaystackExt::addHaystackEquipToNiagara"),
      "name": "create a note",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackApplyAddEquips(" + id.toAxonCode + ",\$deviceSelector,\$siteName)",
      "helpDoc":"/wiki/display/FINStack/Add+Haystack+Equip",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  else do
      // Create a list of selected ids if at least two things are selected.
      selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
      selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {name: "input8", editorType: "list", prompt: toLocale("finNHaystackExt::listOfComponentsToAddEquipsTo"), dataProvider: selDis,
        labelField: "val", height: 100, selectedValueTags: "val",headerIconLeft:"internal:INFO_ICON",headerToolTip:"Add Equips"},
      {name: "siteName", editorType: "textinput",prompt:toLocale("j2FinToolsExt::siteName"),
          toolTip:"This creates and/or references Equips to the Site you enter in here"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    { "dis": toLocale("finNHaystackExt::addEquipmentToNiagra"),
      "name": "create a note",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackApplyAddEquips(" + id.toAxonCode + ",\"\",\$siteName," + selList + ")",
      "helpDoc":"/wiki/display/FINStack/Add+Haystack+Equip",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end

end


def ​

func:finNHaystackFormAddHaystackSlots ​

finNHaystackFormAddHaystackSlots(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormAddHaystackSlots
distoLocale("finNHaystackExt::addHaystackSlot")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will add Haystack slots to points in Niagara
isfunc
liblib:finNHaystackExt
namefinNHaystackFormAddHaystackSlots

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do

    body: [
      {name: "targetFilter", editorType: "textinput",prompt:toLocale("finStackExt::targetFilter"), toolTip: "A filter for the Niagara objects. IE.. point and writable"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    // return form grid
    { "dis": toLocale("finNHaystackExt::addHaystackSlotInNiagra"),
       "name": "TODO do we actually need this?",
       "body": body.toJSON,
       "cancelButton": "\$cancelButton",
       "commitButton": "\$applyButton",
       "commitAction": "finNHaystackAddHaystackSlots(@" + id + ",\$targetFilter)",
       "helpDoc":"/wiki/display/FINStack/Add+Haystack+Slot",
       "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  else do

    // Create a list of selected ids if at least two things are selected.
    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
    selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {name: "input8", editorType: "list", prompt: toLocale("fin5CoreExt::list"), dataProvider: selDis,
        labelField: "val", height: 100, selectedValueTags: "val"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    // return form grid
    { "dis": toLocale("finNHaystackExt::applyBatchEditToAx"),
       "name": "TODO do we actually need this?",
       "body": body.toJSON,
       "cancelButton": "\$cancelButton",
       "commitButton": "\$applyButton",
       "commitAction": "finNHaystackAddHaystackSlots(@" + id + ",\"\"," + selList + ")",
       "helpDoc":"/wiki/display/FINStack/Add+Haystack+Slot",
       "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end

end


def ​

func:finNHaystackFormAdvancedApplyBatchTags ​

finNHaystackFormAdvancedApplyBatchTags(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormAdvancedApplyBatchTags
distoLocale("finNHaystackExt::advancedStringEditor")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis is an advanded form, be careful. It will allow you ...
isfunc
liblib:finNHaystackExt
namefinNHaystackFormAdvancedApplyBatchTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do

    body: [
      {name: "targetFilter", editorType: "textinput",prompt:toLocale("finStackExt::targetFilter"), toolTip: "A filter for the Niagara objects",defVal:"point"},
      {name:"searchTag", editorType:"textinput", prompt:toLocale("j2FinToolsExt::searchTag"),defVal:"navName",toolTip: "The tag name of what you want to search for. IE.. navName" },
      {
        name: "searchFunction",
        editorType: "combobox",
        prompt: toLocale("j2FinToolsExt::searchFunction"),
        dataProvider: [
          {dis:toLocale("j2FinToolsExt::contains"),val:"contains",selected:true},
          {dis:toLocale("j2FinToolsExt::startsWith"),val:"startsWith"},
          {dis:toLocale("j2FinToolsExt::endsWith"),val:"endsWith"}
        ].toAxonCode,
        labelField: "dis",
        selectedValueTags: "val",
        defIndex: 0
      },

      {name:"searchValue", editorType:"textinput", prompt:toLocale("finNHaystackExt::searchStringVal"),defVal:"SupplyAirTemp",toolTip: "The tag value of what you want to apply the new tags to." },
      {name: "tags", editorType: "textinput",prompt:toLocale("j2FinToolsExt::tagsToApplyOrRemove"),
            toolTip: "The tags to apply to the filtered Niagara objects (i.e. number:12,foo) to remove just put -beforeTag",defVal:"navNameFormat:\"SAT\""},

      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    // return form grid
    { "dis": toLocale("finNHaystackExt::applyBatchEditToAx"),
       "name": "TODO do we actually need this?",
       "body": body.toJSON,
       "cancelButton": "\$cancelButton",
       "commitButton": "\$applyButton",
       "commitAction": "finNHaystackAdvancedApplyBatchTagsCommit(@" + id + ",\$targetFilter,\$tags,\$searchTag,\$searchFunction,\$searchValue)",
       "helpDoc": "/wiki/display/FINStack/Advanced+String+Editor",
       "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  end

end


def ​

func:finNHaystackFormApplyBatchTags ​

finNHaystackFormApplyBatchTags(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormApplyBatchTags
distoLocale("finStackExt::gbApplyBatchTags")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will add/edit/remove tags to Niagara
isfunc
liblib:finNHaystackExt
namefinNHaystackFormApplyBatchTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do

    body: [
      {name: "targetFilter", editorType: "textinput",prompt:toLocale("finStackExt::targetFilter"), toolTip: "A filter for the Niagara objects"},
      {name: "tags", editorType: "textinput",prompt:toLocale("j2FinToolsExt::tagsToApplyOrRemove"),
            toolTip: "The tags to apply to the filtered Niagara objects (i.e. number:12,foo) to remove just put -beforeTag"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    // return form grid
    { "dis": toLocale("finNHaystackExt::applyBatchEditToAx"),
       "name": "TODO do we actually need this?",
       "body": body.toJSON,
       "cancelButton": "\$cancelButton",
       "commitButton": "\$applyButton",
       "commitAction": "finNHaystackApplyBatchTags(@" + id + ",\$targetFilter,\$tags)",
       "helpDoc":"/wiki/display/FINStack/Apply+Batch+Tags+-+Haystack",
       "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  else do

    // Create a list of selected ids if at least two things are selected.
    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
    selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {name: "input8", editorType: "list", prompt: toLocale("finNHaystackExt::listOfComponentsToApplyBatchTags"), dataProvider: selDis,
        labelField: "val", height: 100, selectedValueTags: "val"},
      {name: "tags", editorType: "textinput",prompt:toLocale("j2FinToolsExt::tagsToApplyOrRemove"),
            toolTip: "The tags to apply to the filtered Niagara objects (i.e. number:12,foo) to remove just put -beforeTag"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    // return form grid
    { "dis": toLocale("finNHaystackExt::applyBatchEditToAx"),
       "name": "TODO do we actually need this?",
       "body": body.toJSON,
       "cancelButton": "\$cancelButton",
       "commitButton": "\$applyButton",
       "commitAction": "finNHaystackApplyBatchTags(@" + id + ",\"id\",\$tags," + selList + ")",
       "helpDoc":"/wiki/display/FINStack/Apply+Batch+Tags+-+Haystack",
       "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end

end


def ​

func:finNHaystackFormCopyEquipTags ​

finNHaystackFormCopyEquipTags(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormCopyEquipTags
distoLocale("j2FinToolsExt::cloneEquipPointTags")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will clone/create your Equip and Points tags in Nia...
isfunc
liblib:finNHaystackExt
namefinNHaystackFormCopyEquipTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do
    str1: "haystackReadAll(readById(@" + id + "), site)"
    str2: "haystackReadAll(readById(@" + id + "), equip and siteRef == \$siteInput)"

    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"

    body: [
      {name: "siteInput",  editorType: "combobox", prompt: toLocale("j2FinToolsExt::site"),  dataProvider: str1, labelField: "dis", selectedValueTags: "id"},
      {name: "equipInput", editorType: "combobox", prompt: toLocale("finNHaystackExt::equipYouWantToCopy"), dataProvider: str2, labelField: "dis", selectedValueTags: "id"},
      {name: "targetFilter", editorType: "textinput",prompt:toLocale("finStackExt::targetFilter"), toolTip: "A filter for the Niagara objects"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    { "dis": toLocale("finNHaystackExt::cloneEquipAndPtTagsInNiagra"),
      "name": "copyEquipTags",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackCopyEquipTags(@" + id + ",\$equipInput,\$targetFilter)",
      "helpDoc":"/wiki/display/FINStack/Clone+Equip-Point+Tags",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  else do
    str1: "haystackReadAll(readById(@" + id + "), site)"
    str2: "haystackReadAll(readById(@" + id + "), equip and siteRef == \$siteInput)"

    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
    selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {name: "siteInput",  editorType: "combobox", prompt: toLocale("j2FinToolsExt::site"),  dataProvider: str1, labelField: "dis", selectedValueTags: "id"},
      {name: "equipInput", editorType: "combobox", prompt: toLocale("finNHaystackExt::equipYouWantToCopy"), dataProvider: str2, labelField: "dis", selectedValueTags: "id"},
      {name: "input8", editorType: "list", prompt: toLocale("finNHaystackExt::listOfComponentsEffectedByCloning"),
        dataProvider: selDis, labelField: "val", height: 100, selectedValueTags: "val"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    { "dis": toLocale("finNHaystackExt::cloneEquipAndPtTagsInNiagra"),
      "name": "copyEquipTags",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackCopyEquipTags(@" + id + ",\$equipInput,\"id\"," + selList + ")", // "id" will be ignored in nhaystack
      "helpDoc":"/wiki/display/FINStack/Clone+Equip-Point+Tags",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})
  end
end


def ​

func:finNHaystackFormDelete ​

finNHaystackFormDelete(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormDelete
distoLocale("finNHaystackExt::deleteEquip")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will delete the equip component in Niagara.
isfunc
liblib:finNHaystackExt
namefinNHaystackFormDelete
uiFormOnequip

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
  selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

  body: [
    {name: "input8", editorType: "list", prompt: toLocale("finNHaystackExt::listOfComponentsToRemoveTags"), dataProvider: selDis,
      labelField: "val", height: 100, selectedValueTags: "val",toolTip:"IF the component is an Equip it will remove it, if it's a Point it will remove the Haystack Slot. (This will not remove the Point)"},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  { "dis": toLocale("finNHaystackExt::deleteEquipComponetInNiagra"),
    "name": "create a note",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "readById(" + id + ").finNHaystackDelete(" + selList + ")",
    "finForm": marker(),
    "helpDoc":"/wiki/display/FINStack/Delete+Equip"
  }.toGrid.addMeta({formExecute: marker()})

end


def ​

func:finNHaystackFormDeleteHaystackSlot ​

finNHaystackFormDeleteHaystackSlot(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackFormDeleteHaystackSlot
distoLocale("finNHaystackExt::deleteHaystackSlot")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will delete the Haystack Slot in Niagara.
isfunc
liblib:finNHaystackExt
namefinNHaystackFormDeleteHaystackSlot

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do
  query:{ "dis": toLocale("finNHaystackExt::deleteHaystackSlotFromNiagara"),
          "name": "finNHaystackFormDeleteHaystackSlot",
          "cancelButton": "\$cancelButton",
          "commitButton": "\$applyButton",
          "commitAction": "",
          "helpDoc": "/wiki/display/FINStack/Delete+Haystack+Slot",
          "finForm": marker() }

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do
    body: [
      {name: "targetFilter", editorType: "textinput",prompt:toLocale("finStackExt::targetFilter"), toolTip: "A filter for the Niagara objects. IE.. point and writable"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    query = query.set("commitAction", "readById("+id+").finNHaystackDeleteHaystackSlot(haystackReadAll(@"+id+", parseFilter(\$targetFilter)).toRecIdList)")
  end
  else do
    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
    selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {name: "input8", editorType: "list", prompt: toLocale("finNHaystackExt::listOfComponentsToRemoveHaystackSlot"), dataProvider: selDis, labelField: "val", selectedValueTags: "val"},
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
    ]

    query = query.set("commitAction", "readById("+id+").finNHaystackDeleteHaystackSlot("+selList+")")
  end

  query.set("body", body.toJSON).toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackFormPriorityArray ​

finNHaystackFormPriorityArray(id) ​

Axon function


meta ​

deffunc:finNHaystackFormPriorityArray
distoLocale("finNHaystackExt::haystackPriorityArray")
formOnhaystackWrite
helpThis will display the haystack PriorityArray.
isfunc
liblib:finNHaystackExt
namefinNHaystackFormPriorityArray
uiFormOnpoint

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do

  rec: toRec(id)
  provider:
      "finNHaystackPointWriteArray(@" + rec->haystackConnRef + ", @" + rec->haystackCur + ")" +
      ".map((r) => if (not r.has(\"val\")) r.set(\"val\", \"null\") else r)"

  body: [
    { name: "table",
      editorType: "table",
      prompt: toLocale("finNHaystackExt::haystackPriorityArray"),
      height:500,
      dataProvider: provider
    },
    {name: "okButton", editorType: "button", label: toLocale("finStackExt::ok"), controlBar: true},
  ]

  { "dis": toLocale("finNHaystackExt::haystackPriorityArray"),
    "name": "foo",
    "body": body.toJSON,
    "cancelButton": "\$okButton",
    "helpDoc": "/wiki/display/FINStack/Haystack+Priority+Array",
    "finForm": marker()
  }.toGrid.addMeta({formExecute: marker()})

end


def ​

func:finNHaystackFormRebuildCache ​

finNHaystackFormRebuildCache(id) ​

Axon function


meta ​

deffunc:finNHaystackFormRebuildCache
distoLocale("finNHaystackExt::rebuildCache")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpThis will execute nHaystack action to rebuild cache in N...
isfunc
liblib:finNHaystackExt
namefinNHaystackFormRebuildCache

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id) => do

  body: [
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]

  { "dis": toLocale("finNHaystackExt::rebuildNHaystackCacheInNiagra"),
    "name": "TODO do we actually need this?",
    "body": body.toJSON,
    "cancelButton": "\$cancelButton",
    "commitButton": "\$applyButton",
    "commitAction": "finNHaystackRebuildCache(@" + id + ")",
    "helpDoc":"/wiki/display/FINStack/Rebuild+Cache",
    "finForm": marker()

  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackFormSyncEquips ​

finNHaystackFormSyncEquips(id) ​

Axon function


meta ​

appFormOnoldFolio
deffunc:finNHaystackFormSyncEquips
distoLocale("finNHaystackExt::nHaystackSyncEquips")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
isfunc
liblib:finNHaystackExt
namefinNHaystackFormSyncEquips

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id)=> do
  filter:"haystackConn "
  if(id != null) do
    rec:read(parseFilter("id==@"+id),false)
    if(rec != null and rec.has("haystackConn"))
      filter = filter + " and id==@"+id.toStr
  end

  body:[
    {name:"connFilter",editorType:"textinput",defVal:filter,prompt:toLocale("finNHaystackExt::affectedConnector")},
    {name:"targetFilter",editorType:"textinput",defVal:"point and equipRef==", prompt:toLocale("j2FinToolsExt::equipFilter")},
    {name:"updateNavName",editorType:"checkbox",label:toLocale("finNHaystackExt::updateNavName")},
    {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
    {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
  ]
  { "dis": toLocale("finNHaystackExt::syncNiagaraEquips"),
    "name": "finFormSyncNiagaraEquips",
   "body": body.toJSON,
   "cancelButton": "\$cancelButton",
   "commitButton": "\$applyButton",
   "commitAction": "finNHaystackSyncNiagaraEquipApply(\$connFilter,\$targetFilter,\$updateNavName)",
   "finForm": marker(),
   "helpDoc":"/wiki/display/FINStack/Nhaystack+Sync+Equips",
   "refreshTrees": marker()
  }.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackInvoke ​

finNHaystackInvoke(id, action, args: null) ​

Axon function


meta ​

deffunc:finNHaystackInvoke
isfunc
liblib:finNHaystackExt
namefinNHaystackInvoke

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, action, args: null) => do

    rec: toRec(id)
    conn: toRec(rec->haystackConnRef)

    if (args == null)
        haystackInvokeAction(conn, rec->haystackWrite, action)
    else
        haystackInvokeAction(conn, rec->haystackWrite, action, args)

end


def ​

func:finNHaystackMapPointsToEquip ​

finNHaystackMapPointsToEquip(conn, siteNavName, equipNavName, ids) ​

finNHaystackMapPointsToEquip

This method applies equipRef tags to a list of points, so that those points become children of the given equip. If there is no Equip or Site by those name(s) in niagara, then an Equip and/or Site is created.

The rebuildCache action should be run in Niagara after this method is invoked.


meta ​

constructfinNHaystackMapPointsToEquip(conn, siteNavName, equipNav...
deffunc:finNHaystackMapPointsToEquip
examplefinNHaystackMapPointsToEquip(@connId, "mySite", "myEquip...
isfunc
liblib:finNHaystackExt
namefinNHaystackMapPointsToEquip

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackMapPointsToEquipApply ​

finNHaystackMapPointsToEquipApply(items, site, equip) ​

Axon function


meta ​

deffunc:finNHaystackMapPointsToEquipApply
isfunc
liblib:finNHaystackExt
namefinNHaystackMapPointsToEquipApply
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(items,site,equip)=> do
  if(items == "") return []
  mymap:{}
  items.each(p=> do
    connId:p.get("connRef")
    ar :[]
    if(mymap.has(connId.toStr))
      ar = mymap.get(connId.toStr)
    ar = ar.add(p)
    mymap = mymap.set(connId.toStr,ar)
  end)
  mymap.each((arr,conn)=>do
    connId:parseRef(conn)
    arr = arr.map(r=>r->id.toStr.replace("@",""))
    if(arr.size > 0) do
      try
        finNHaystackMapPointsToEquip(connId,site,equip,arr)
      catch(err) logErr("NHaystack","failed mapping points to equip",err)
    end
  end)
end


def ​

func:finNHaystackPointWriteArray ​

finNHaystackPointWriteArray(conn, id) ​

finNHaystackPointWriteArray


meta ​

constructfinNHaystackPointWriteArray(conn, id)
deffunc:finNHaystackPointWriteArray
examplefinNHaystackPointWriteArray(@connId, @myPointId) This e...
isfunc
liblib:finNHaystackExt
namefinNHaystackPointWriteArray

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackPullPropTags ​

finNHaystackPullPropTags(conn, tags, filter, ids: [,]) ​

finNHaystackPullPropTags


meta ​

constructfinNHaystackPullPropTags(conn, tags, filter)
deffunc:finNHaystackPullPropTags
examplefinNHaystackPullPropTags(@connId, ["foo","bar"], "kind =...
isfunc
liblib:finNHaystackExt
namefinNHaystackPullPropTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackPullPropsForm ​

finNHaystackPullPropsForm(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackPullPropsForm
distoLocale("finNHaystackExt::pullPropertyTags")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpPull the properties or facets out of Niagara and update ...
isfunc
liblib:finNHaystackExt
namefinNHaystackPullPropsForm
uiFormOnhaystackConn or point

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do
    body: [
      {
        name: "filterText",
        editorType: "textinput",
        defVal:"point",
        prompt:toLocale("finStackExt::finFilter")
      },
      {
         name: "tagsToPull",
         editorType: "list",
         prompt: toLocale("finNHaystackExt::selectTagsToPull"),
         dataProvider: "[\"minVal\",\"maxVal\",\"precision\",\"unit\",\"enum\",\"actions\"]",
         listType: "checkbox",
         labelField: "val",
         height: 150,
         selectedValueTags: "val"
      },
      { name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      { name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true},
    ]

    { "dis": toLocale("finNHaystackExt::pullNiagraProperties"),
      "name": "foo",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackPullPropTags(@" + id +",\$tagsToPull,\$filterText)",
      "helpDoc":"/wiki/display/FINStack/Pull+Property+Tags",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  // something selected
  end else do

    // Create a list of selected ids if at least two things are selected.
    selList: "[" + selectedDicts.map() (row => "@" + row->id.toStr).concat(",") + "]"
    selDis: "[" + selectedDicts.map() (row => "\"" + row->id.toStr + "\"").concat(",") + "]"

    body: [
      {
        name: "selected",
        editorType: "list",
        prompt:toLocale("finNHaystackExt::listOfComponentsToPullPropsFrom"),
        dataProvider: selDis,
        labelField: "val",
        height: 150,
        selectedValueTags: "val"
      },
      {
         name: "tagsToPull",
         editorType: "list",
         prompt: toLocale("finNHaystackExt::selectTagsToPull"),
         dataProvider: "[\"minVal\",\"maxVal\",\"precision\",\"unit\"]",
         listType: "checkbox",
         labelField: "val",
         height: 150,
         selectedValueTags: "val",
      },
      {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
      {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
    ]

    { "dis": toLocale("finNHaystackExt::pullNiagraProperties"),
      "name": "foo",
      "body": body.toJSON,
      "cancelButton": "\$cancelButton",
      "commitButton": "\$applyButton",
      "commitAction": "finNHaystackPullPropTags(@" + id + ",\$tagsToPull,\"\"," + selList + ")",
      "helpDoc":"/wiki/display/FINStack/Pull+Property+Tags",
      "finForm": marker()
    }.toGrid.addMeta({formExecute: marker()})

  end
end


def ​

func:finNHaystackQuery ​

finNHaystackQuery(id, selectedIds) ​

Axon function


meta ​

appFormOnbuilder,oldFolio
deffunc:finNHaystackQuery
distoLocale("finNHaystackExt::nHaystackQuery")
finForm✓
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
isfunc
liblib:finNHaystackExt
namefinNHaystackQuery

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id,selectedIds)=>do
filter:"haystackConn "
if(selectedIds != null) do
  filter = filter + "and (" + selectedIds.map(rec=>"id==@" + rec->id).concat(" or ") +")"
end

body:[
  {name:"filter",editorType:"textinput",defVal:"point and temp",prompt:toLocale("finStackExt::finFilter")},
  {name:"tag",editorType:"textinput",defVal:"dis", prompt:toLocale("j2FinToolsExt::searchTag")},
  {
    name:"option",
    editorType:"combobox",
    labelField:"dis",
    selectedValueTags:"val",
    defIndex:0,
    dataProvider:[
      {dis:toLocale("j2FinToolsExt::contains"),val:"contains",selected:true},
      {dis:toLocale("j2FinToolsExt::startsWith"),val:"startsWith"},
      {dis:toLocale("j2FinToolsExt::endsWith"),val:"endsWith"}
    ].toAxonCode
  },
  {name:"needle",editorType:"textinput"},
  {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
  {name: "applyButton", editorType: "button", label: toLocale("finStackExt::coreApply"), controlBar: true}
]
{ "dis": toLocale("finNHaystackExt::nHaystackBatchEditTags"),
"name": "finNHaystackQueryForm",
"body": body.toJSON,
"cancelButton": "\$cancelButton",
"commitButton": "\$applyButton",
"commitAction":"",
"gotoAction": "finstack:folio:axonQuery=nHaystackQueryApply(\""+ filter +"\",\"\$filter\",\"\$tag\",\"\$option\",\"\$needle\")",
"finForm": marker(),
"helpDoc":"/wiki/display/FINStack/Nhaystack+Query",
}.toGrid.addMeta({formExecute: marker()})
end


def ​

func:finNHaystackReadSize ​

finNHaystackReadSize(conn, filter) ​

finNHaystackReadSize This method calls read with the given filter, and then counts the number of resulting recs.


meta ​

constructfinNHaystackReadSize(conn, filter)
deffunc:finNHaystackReadSize
examplefinNHaystackReadSize(@connId, "point and temp") This ex...
isfunc
liblib:finNHaystackExt
namefinNHaystackReadSize

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackReadUnique ​

finNHaystackReadUnique(conn, filter, column) ​

finNHaystackReadUnique This method calls read with the given filter, and then finds the unique values of the given column


meta ​

constructfinNHaystackReadUnique(conn, filter, column)
deffunc:finNHaystackReadUnique
examplefinNHaystackReadUnique(@connId, "point", "tz") This exa...
isfunc
liblib:finNHaystackExt
namefinNHaystackReadUnique

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackRebuildCache ​

finNHaystackRebuildCache(conn) ​

finNHaystackRebuildCache This method calls rebuildCache in NHaystack. This is an expensive operation, so be careful.


meta ​

constructfinNHaystackRebuildCache()
deffunc:finNHaystackRebuildCache
isfunc
liblib:finNHaystackExt
namefinNHaystackRebuildCache

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackRemoveBrokenRefs ​

finNHaystackRemoveBrokenRefs(haystackConn) ​

Axon function


meta ​

deffunc:finNHaystackRemoveBrokenRefs
distoLocale("finNHaystackExt::removeBrokenRefs")
isfunc
liblib:finNHaystackExt
namefinNHaystackRemoveBrokenRefs

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(haystackConn) => do
  haystackCall(haystackConn, "extended", toGrid([{function:"rebuildCache"}]))
end


def ​

func:finNHaystackSearchAndReplace ​

finNHaystackSearchAndReplace(conn, filter, searchText, replaceText, ids: [,]) ​

finNHaystackSearchAndReplace This method renames components by replacing searchText with replaceText.


meta ​

constructfinNHaystackSearchAndReplace(conn, filter, searchText, r...
deffunc:finNHaystackSearchAndReplace
examplefinNHaystackSearchAndReplace(@connId, "point", "foo", "b...
isfunc
liblib:finNHaystackExt
namefinNHaystackSearchAndReplace

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackShowPointsInWatch ​

finNHaystackShowPointsInWatch(conn, watchId) ​

finNHaystackShowPointsInWatch


meta ​

constructfinNHaystackShowPointsInWatch(conn, watchId)
deffunc:finNHaystackShowPointsInWatch
examplefinNHaystackShowPointsInWatch(@connId, @watchId) This e...
isfunc
liblib:finNHaystackExt
namefinNHaystackShowPointsInWatch

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackShowWatches ​

finNHaystackShowWatches(conn) ​

finNHaystackShowWatches


meta ​

constructfinNHaystackShowWatches(conn)
deffunc:finNHaystackShowWatches
examplefinNHaystackShowWatches(@connId) This example returns a...
isfunc
liblib:finNHaystackExt
namefinNHaystackShowWatches

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackSyncNiagaraEquipApply ​

finNHaystackSyncNiagaraEquipApply(connFilter, targetFilter, updateNavName) ​

Axon function


meta ​

deffunc:finNHaystackSyncNiagaraEquipApply
isfunc
liblib:finNHaystackExt
namefinNHaystackSyncNiagaraEquipApply
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(connFilter,targetFilter,updateNavName)=> do
  conn: read(parseFilter(connFilter))
  points: readAll(parseFilter(targetFilter))
  map:{}
  points.each(p=>do
    if(p.has("haystackCur")) do
      cur :p.get("haystackCur").toStr
      curAr :cur.split(".")
      equipName: curAr.remove(-1).concat(".")
      arr:[]
      if(map.has(equipName))
        arr = map.get(equipName)
      arr = arr.add(p)
      map = map.set(equipName,arr)
    end
  end)
  //ignored tags
  ignored:[
  "id", "mod",
  "axAnnotated", "axStatus",
  "cur", "curDis", "curErr", "curStatus", "curVal",
  "dis", "disMacro", "equip", "equipRef", "floorRef",
  "haystackConnRef", "haystackCur",
  "his", "hisCollectInterval", "hisEnd", "hisEndVal", "hisErr", "hisId",
  "hisSize", "hisStart", "hisStatus",
  "kind", "navName", "navNameFormat", "point", "precision", "sensor",
  "site", "siteRef", "tz",
  "writeErr", "writeLevel", "writeStatus", "writeVal",
  "actions","enum","function","haystackWrite","haystackWriteLevel","hisCollectCov","writable"
  ]
  ignoredfs:["id","dis","mod","axType","axSlotPath","navName","siteRef","floorRef"]

  nequips:conn.haystackReadAll(parseFilter("equip"))

  map.each((arr,equipName)=>do
    p:arr[0]
    equipRec: p->equipRef.toRec
    nequipRec: nequips.find(e=> e->id.toStr==equipName)
    //echo("equipRec:"+nequipRec)
    if(nequipRec != null) do
      tags:[]
      equipRec.each((val,key)=>do
        if(ignored.index(key)<0)do
          if(val == marker())
            tags = tags.add(key)
          else
            tags = tags.add(key+":"+val)
        end
      end)
      tagApply : tags.concat(",")
      //sync equip from fs to niagara
      if(tagApply != "") do
        if(not updateNavName)
          finNHaystackApplyBatchTags(conn,equipFilter,tagApply)
        else do

          tagApply = tags.add("navNameFormat",equipRec.get("navName")).concat(",")
          finNHaystackApplyBatchTags(conn,equipFilter,tagApply)

          if(equipName.startsWith("S.")) do
            //update haystackCur,haystackWrite, haystackHis of all points of this equip
            arr.each(p=>do
              changes:{}
              if(p.has("haystackCur")) do
                path: (p.get("haystackCur").toStr).split(".")
                name:path[-1]
                changes = changes.set("haystackCur",parseRef("S."+ equipName + "."+name))
              end
              if(p.has("haystackHis")) do
                path:(p.get("haystackCur").toStr).split(".")
                name:path[-1]
                changes = changes.set("haystackHis",parseRef("S."+ equipName + "."+name))
              end
              if(p.has("haystackWrite")) do
                path:(p.get("haystackCur").toStr).split(".")
                name:path[-1]
                changes = changes.set("haystackWrite",parseRef("S."+ equipName + "."+name))
              end
              //echo("changes:"+changes)
              diff(p,changes).commit
            end)
          end
        end
      end

    //sync equip from niagara to fs
      changes:{}
      nequipRec.each((val,key)=> do
        if(ignoredfs.index(key) < 0 and not equipRec.has(key)) do
          changes = changes.set(key,val)
        end
      end)
      //echo("n2fs changes:"+changes)
      try
        diff(equipRec,changes).commit
      catch(er) logErr("NHaystack","failed to sync equip from niagara",er)
    end

  end)
end


def ​

func:finNHaystackUniqueEquipTypes ​

finNHaystackUniqueEquipTypes(haystackConn) ​

Axon function


meta ​

deffunc:finNHaystackUniqueEquipTypes
distoLocale("finNHaystackExt::fetchNHaystackUniqueEquipType...
examplefinNHaystackUniqueEquipTypes(read(haystackConn and dis==...
helpFetch unique equip types from an NHaystack AX station
isfunc
liblib:finNHaystackExt
namefinNHaystackUniqueEquipTypes

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(haystackConn) => do
  haystackCall(haystackConn, "extended", toGrid([{function:"uniqueEquipTypes"}]))
end


def ​

func:finNHaystackUniqueTags ​

finNHaystackUniqueTags(conn, filter) ​

finNHaystackUniqueTags


meta ​

constructfinNHaystackUniqueTags(conn, filter)
deffunc:finNHaystackUniqueTags
examplefinNHaystackUniqueTags(@connId, "point") This example r...
isfunc
liblib:finNHaystackExt
namefinNHaystackUniqueTags

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finNHaystackViewEquipTypesCommit ​

finNHaystackViewEquipTypesCommit(connId, tagsToApply) ​

Axon function


meta ​

deffunc:finNHaystackViewEquipTypesCommit
isfunc
liblib:finNHaystackExt
namefinNHaystackViewEquipTypesCommit
private✓

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(connId, tagsToApply) => do

  tagsToApply.each s => do
      id: toStr(s->id)
      tags: s->tags
      targetFilter: "equipType == " + parseInt(id[4..-1])
      finNHaystackApplyBatchTags(connId, targetFilter, tags)
  end

end


def ​

func:finNHaystackViewEquipTypesForm ​

finNHaystackViewEquipTypesForm(id, selectedDicts: null) ​

Axon function


meta ​

deffunc:finNHaystackViewEquipTypesForm
distoLocale("finNHaystackExt::viewEquipTypes")
folderPathtoLocale("finStackExt::rightMenuConnectors") + "/" + toL...
formOnhaystackConn
helpView Equipment Types
isfunc
liblib:finNHaystackExt
namefinNHaystackViewEquipTypesForm

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(id, selectedDicts: null) => do

  if (selectedDicts == null or selectedDicts.size == 0)
    return {}

  if (selectedDicts[0].has("haystackConn"))  do
    numFound: try finNHaystackUniqueEquipTypes(id).size() catch 0

    if (numFound > 0) do
      body: [
          { name: "EquipTypes",
            editorType: "table",
            dataProvider: "finNHaystackUniqueEquipTypes(" + id.toAxonCode + ")",
            height: 200,
            toolTip: "Copy and Paste this to Excel to view better"
          },
          {
            name: "tagsToApply",
            editorType: "list",
            prompt: toLocale("finNHaystackExt::selectEquipTypesAndTagsToApply"),
            defValTagName: "selected",
            dataProvider: "finNHaystackUniqueEquipTypes(" + id.toAxonCode + ")",
            height: 125,
            itemRenderer: [
              {name: "selected", editorType: "checkbox"},
              {name: "id", editorType: "label", text: "\$id"},
              {name: "tags", editorType: "textinput"}
            ],
            toolTip: "Tags to apply e.g. 'foo, num:42'"
          },

        {name: "cancelButton", editorType: "button", label: toLocale("finStackExt::cancel"), controlBar: true},
        {name: "applyButton",  editorType: "button", label: toLocale("finStackExt::coreApply"),  controlBar: true}
      ]

      // return form grid
      { "dis": toLocale("finNHaystackExt::viewEquipTypesAndApplyBatchTags"),
         "name": "TODO do we actually need this?",
         "body": body.toJSON,
         "cancelButton": "\$cancelButton",
         "commitButton": "\$applyButton",
         "commitAction": "finNHaystackViewEquipTypesCommit(" + id.toAxonCode + ",\$tagsToApply)",
         "helpDoc":"/wiki/display/FINStack/View+Equip+Types",
         "finForm": marker()
      }.toGrid.addMeta({formExecute: marker()})
    end
    else
      return finFormAlertOk(toLocale("finNHaystackExt::viewEquipTypesAndApplyBatchTags"), toLocale("finNHaystackExt::noUniqueEquipsFound").replace("{name}", readById(id).dis))

  end

end


def ​

func:finToAlarm ​

finToAlarm(params) ​

finToAlarm


meta ​

deffunc:finToAlarm
isfunc
liblib:finNHaystackExt
namefinToAlarm

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:finToNormal ​

finToNormal(params) ​

finToNormal


meta ​

deffunc:finToNormal
isfunc
liblib:finNHaystackExt
namefinToNormal

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function


def ​

func:nHaystackQueryApply ​

nHaystackQueryApply(connFilter, filter, tag, option, needle) ​

Axon function


meta ​

deffunc:nHaystackQueryApply
isfunc
liblib:finNHaystackExt
namenHaystackQueryApply

supertypes ​

featureFeature namespace of definitions formatted as feature:name
funcAxon function

src ​

(connFilter,filter,tag,option,needle)=>do
  conns:readAll(parseFilter(connFilter))

  rows:[]
  conns.each(conn=>do
    rs:conn.haystackReadAll(parseFilter(filter)).findAll(p=> do
      val:""
      if(p.has(tag))
        val = p.get(tag)
      else if(tag == "dis")
        val = p.dis
      if(val != null)
        val = val.toStr.lower
      if(option == "startsWith")
        return val.startsWith(needle.lower)
      else if(option == "endsWith")
        return val.endsWith(needle.lower)
      else if(option == "contains")
        return val.contains(needle.lower)

      return false
    end)
    if(rs != null) do
      rs = rs.map(p=> do
        return p.set("connRef",conn->id)
      end)
      rows = rows.addAll(rs.toRecList)
    end
  end)
  return rows
end