Manage Learn to apply best practices and optimize your operations.

# Array Initialize

## Assign a great number of elements to an array

You can view feedback to this tip!

In LotusScript, it's not possible to initialize a one dimension table in one
step with more than one element. Thanks to this script, you can assign a great
number of elements to an array and this is in two line code!

----------------------------------------------
Example :

Dim Chaine As String
Dim Array() As String ' --> Tableau de 7 ?l?ments
Chaine = "Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi,Dimanche" ' --> 7 element

Call Arrayass(Array,String)
-------------------------------------------

After execution, the Array variable contents is:
[[Lundi][Mardi][Mercredi][Jeudi][Vendredi][Samedi][Dimanche]]

Array(1)=Lundi
Array(5)=Vendredi
Array(7)=Dimanche

Note : The separator must be a "," or a ";"
Sub Arrayass(Tabl() As String, Chaine As String)

Dim i,start,Element As Integer
Dim temp As String

start=1
Element=1

Do

i=1
Do
temp=Mid\$(Chaine,start,i)
i=i+1
Loop Until Right(temp,1)="," Or Right(temp,1)=";" Or start+i-2=Len(Chaine)

Tabl(Element)=LTrim\$(Left(temp,Len(temp)-1 + (start+i-2=Len(Chaine))*(-1)))
start=start+i-1
Element=Element+1

Loop Until Len(Chaine)=start-1

End Sub

FEEDBACK:

• This is beautiful work by Fabient, but there are a couple of "gotchas" in making it work.

The following will correctly set up and call the code:

```Dim Chaine As String
Dim Array(7) As String

'Vary the 7 according to
'the elements you plan to put
'into the array.
'The posted code doesn't
'declare the array length
'producing an out of bounds error
'after the first element

Chaine = "Lundi,Mardi,Mercredi,Jeudi,Vendredi,Samedi,Dimanche"
' --> 7 elements

Call Arrayass(Array,Chaine)
'show the results on the status bar
For myi = 1 To 7
Print Array(myi)
Next```

## SearchWindowsServer

• ### Exchange Server bugs continue to bite on April Patch Tuesday

Microsoft resolves 110 vulnerabilities, including a zero-day and four public disclosures, but the company says admins should ...

• ### Azure MFA NPS extension boosts authentication capabilities

With help from the Network Policy Server extension, organizations can expand their on-premises authentication features by tapping...

• ### Azure File Sync service puts pep in hybrid storage setups

Microsoft's Azure Files offering alleviates traditional support efforts and hardware costs. Using this additional service can ...

## Search400

• ### Favorite iSeries cheat sheets

Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...

• ### HTML cheat sheet

This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

• ### Carol Woodbury: Security

Carol Woodbury

## SearchDataCenter

• ### Programmable processor technology for next-gen data centers

The right processing technology can benefit your data center. Learn about advancements in CPU technologies, recent vendor ...

• ### Data processing units accelerate infrastructure performance

DPUs often run on networking packets to move information in the data center, instead of supporting processing workflows. Get an ...

• ### New Intel Ice Lake processors boost performance, security

Intel launches third-generation Xeon Scalable processors that bolster security, accelerate common data center workloads by 46% on...

## SearchContentManagement

• ### OpenText releases Cloud Editions content services updates

OpenText CE 21.2 includes federated document compliance that extends to Microsoft Office 365, along with a revamped content ...