Hi,
I am capturing the workflow process in an array. The values in the array looks like…“Director”, “HR”, “VP”, “HR”
Here we have two HR and I want to change the last HR to VPHR dynamically. How can i do this? Any idea please let me know.
Thanks
Sri
Hi,
I am capturing the workflow process in an array. The values in the array looks like…“Director”, “HR”, “VP”, “HR”
Here we have two HR and I want to change the last HR to VPHR dynamically. How can i do this? Any idea please let me know.
Thanks
Sri
Subject: How to chnage only the last value from a dynamic array?
use ubound(array) to get the upper bound (last element #) of the array then just change it like this:
last% = Ubound(array)
array(last%) = “VPHR”
Subject: RE: How to chnage only the last value from a dynamic array?
Thanks verymuch. That worked.
Subject: How to chnage only the last value from a dynamic array?
Are you trying to @Unique() an array in LotusScript?..if so, using Lists is great for this…
dim s_mylist list as String
dim a_somearray() as string
'// Process loads array.
Forall v in a_somearray
s_mylist( v ) = "somevalue2
'// I don’t usually add the value to the list…see below
End Forall
'// Now your list contains unique values. To loop across list
Forall lv in s_mylist
print lv '// Gives you then value in the list, in case above “somevalue”
print ListTag( lv ) '// Would give you the unique key of list, in your case, HR, DIR, etc.
End Forall
If I know I want unique values, I never bother with arrays, no redim preserve needed, if you can’t do a redim myarray ahead of time (because redim preserve is bad performance wise - i think).
Lists automatically “redim” and they hold unique key values.
Subject: RE: How to chnage only the last value from a dynamic array?
FYI - easy way to get a unique array is to use ArrayUnique function, no need to loop
Subject: How to chnage only the last value from a dynamic array?
Looks like you have to use two For-loops to get word duplicates and to get the last found duplicate.Then use array(last_position) or array(ubound(array)) to get the last found duplicate or the very last entry in this array, then change the value…