Making VBScript conditional on item type
I have a VBScript function called constructPath which appears in the row equation for a field called Kind as:
=constructPath(item, itemparent, itemgparent)
The script of the function is:
Function constructPath(item, itemparent, itemgparent)
' This function creates a Windows-like hierarchical "path".
' Ideally, this function would be coded recursively, but I cannot find a way to make InfoQube return the parent of a given item in code.
' As coded, it only permits a three level hierarchy, grandparent, parent and item.
Dim fullPath
If itemparent = "" Then ' Item is a TLI
fullPath = "\\" + ftrim(item) + "\\" 'Note that it's necessary to use "\\" to assign a single backslash, because backslash escapes the next character in VBScript.
Else
if itemgparent = "" Then
' This function creates a Windows-like hierarchical "path".
' Ideally, this function would be coded recursively, but I cannot find a way to make InfoQube return the parent of a given item in code.
' As coded, it only permits a three level hierarchy, grandparent, parent and item.
Dim fullPath
If itemparent = "" Then ' Item is a TLI
fullPath = "\\" + ftrim(item) + "\\" 'Note that it's necessary to use "\\" to assign a single backslash, because backslash escapes the next character in VBScript.
Else
if itemgparent = "" Then
- Read more about Making VBScript conditional on item type
- 2 comments
- Log in or register to post comments