Get the reverse of an alias

Get the reverse of an alias

If you have a field called "KeywordList" that has the following values:

"Test1 | 1"
"Test2 | 2"
"Test3 | 3"
"Test4 | 4"
"Test5 | 5"

That you use to populate another keyword field Called "SelectFromList" 

After a person selects the values: 
the values 1,5 are stored in "SelectFromList."

For whatever reason, you need to know the Alias. If the list is very
large, this becomes very difficult.
The GetReverseAlias function tells you what those Alias are.  

How to call
Call doc.ReplaceItemValue( "SelectedFromListAlias" , GetReverseAlias(
doc.GetItemValue( "KeywordList" ), doc.GetItemValue( "SelectFromList" ))  )

Function GetReverseAlias( varAllList As Variant, varKeywords As Variant ) As Variant
	Dim Alllist List As String
	Dim strAlias As String
	Dim strValue As String
	Dim strReturn() As String
	Dim intCount As Integer
	intCount = 0
	Redim strReturn(intCount)
	strReturn(intCount) = ""
	Forall strOneValue In varAllList
		strAlias = Trim( LeftOfString( Cstr( strOneValue ), "|" ) )
		strValue = Trim( RightOfString( Cstr( strOneValue ), "|" ) )
		If Not ( Iselement( AllList( strValue ) ) ) Then
			Alllist( strValue )  = strAlias
		End If
	End Forall
	Forall strOneKeyword In VarKeywords
		Redim Preserve strReturn(intCount)
		If  Iselement( AllList( strOneKeyword ) ) Then
			strReturn(intCount) = Alllist( strOneKeyword ) 
			strReturn(intCount) = ""
		End If
		intCount = intCount + 1
	End Forall
	GetReverseAlias = strReturn
End Function

Function RightOfstring ( strSource As String, strSearch As String ) As String
	Dim intPos As Integer
	Dim intLength As Integer
	Dim intStart As Integer
	intPos = Instr ( strSource, strSearch )
	intLength = Len( strSource )
	intStart = intLength - ( intPos + Len( strSearch ) - 1 )
	RightOfstring = Right ( strSource, intStart )
End Function

Function LeftOfstring ( strSource As String, strSearch As String ) As String
	Dim intPos As Integer
	intPos = Instr ( strSource, strSearch )
	If intPos > 0 Then intPos = intPos -1
	LeftOfstring = Left ( strsource, intPos )
End Function
This was first published in June 2001

Dig Deeper on Domino Resources



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...