Editing a multidimensional array


Is there a way using a Text Editor object along with TextEditingResult variable to edit a multidimensional array? Here is an example.

PhoneNumberDescription;PhoneNumber;PhoneExt (each “record” separated by a cr())
So the data is.

Work;(555) 555-555;ext 1
Fax;(565) 666-8899;

This Phone array is in a variable called vPeoplePhoneArray. I have the Text Editor Object showing the correct value and I have I have tried this code to change Fax (the second “record” of the cr() array), but I can’t get it to work. It keeps changing the the first Array element of the cr() delimited main array (Work). It won’t change the 2nd line (Fax)

vPeoplePhoneArray=arraychange(Array(vPeoplePhoneArray,2,cr()), TextEditingResult, 1, “;”)


Do you want to change just one fax number, several of them or all of them?


Hi Michael,

I want to change or add a phone number. So if the Fax number was entered incorrectly and it should really be a Cell number I want to just change Fax to Cell. Same with the actual phone numbers. Also I want to add a phone number to the array if needed.

Make sense?


It sounds like you have a carriage return preceding the first line. That would make your first cr() separated element an empty element, and the first visible line, the second element.


Not quite. I’m just looking at this as a problem in manipulating a multi-dimensional array, leaving you to insert the code into your Text Editor object.

I’m guessing that each object applies to one person and is an array of CR-delimited records, each containing three semi-colon-delimited elements, that the second of these CR-delimited records is always a fax number and that you want to amend the fax number. If so, this should do the job:
vPeoplePhoneArray = arraychange(vPeoplePhoneArray, arraychange(array(vPeoplePhoneArray,2,cr()),TextEditingResult, 2, ";"), 2, ¶)

Let me know if it doesn’t - I may be misinterpreting your data structure.