help with map

droidman

Member
Licensed User
Longtime User
I'm trying to add stuff to a list and export to csv, it works already but i want to export all the data i can get, so i added about 6 columns to the csv like:

Code: Copy
list1.Add (Array As String ("Name (or e-mail if name missing)","Home Phone", "Mobile phone", "E-mail (home)", "E-mail (work)","E-mail (Custom)", "Times contacted"))

and then below i go from 0 to listOfContacts.Size - 1
adding data to the list:

Code: Copy
list1.Add (Array As String (myContact.DisplayName, myContact.PHONE_HOME,myContact.PHONE_MOBILE,myContact.EMAIL_HOME, myContact.EMAIL_WORK, myContact.EMAIL_CUSTOM, "Contacted: " & mycontact.TimesContacted & " times"))

byt this is a map or something, contact data like myContact.PHONE_MOBILE only say "1" or "2" wich is the number of phones the user have. how do i add the number instead of 1 or 2.
i want to keep this simple

thanks in advance
 
ok but i have a small problem here, if i add Contact.GetPhones(1) for example, and it is empty, the program crashes. i have to do a for cycle to get all those values and then add them to variables, affter that add them to the list, is that right?
if so, what is the FOR value limit? 2 or 3 ? (if starts at 0)
 
Upvote 0
You should iterate over the available values.
For example if you prefer the HOME phone number you can use this code:
Code: Copy
    Dim c As Contact
    Dim phones As Map
    Phones = c.GetPhones
    Dim p As String 'Holds the result
    p = "N/A"
    For i = 0 To Phones.Size - 1
        p = Phones.GetKeyAt(i)
        If Phones.GetValueAt(i) = c.PHONE_HOME Then Exit
    Next
 
Upvote 0
Back
Top