Adam:
Thanks again… yes, the existing inventory is in text form… as exported from a Windows Excel spreadsheet.
I may be approaching the problem in the wrong way… and maybe asking about it in the wrong way as well. In my last script example, the two new sample entries were carelessly selected… as needing to be added at the beginning or the end of the existing list.
I will also need to add entries that are between numeric values in the list:
set new_list_entry to “0418047 1.05 2 $2.10”
set existing_list to “0418044 2.49 1 $2.49
0418045 2.47 2 $4.94
0418055 2.25 15 $33.75
0418058 3.21 1 $3.21”
… so that the resultant list becomes:
0418044 2.49 1 $2.49
0418045 2.47 2 $4.94
0418047 1.05 2 $2.10
0418055 2.25 15 $33.75
0418058 3.21 1 $3.21
–
The ‘front end’ for new entries I already have working…
(I hesitate to add this because it may only confuse the issue further. Each set of new entry values are entered in an HTML form, then passed to a target script {the one I’m working on} via Missing Link.)
The target script parses out the values and sets them in tab delimited form:
set inventory_addition to part_num & tab & unit_cost & tab & stock_quan & tab & exten_value
… to create a new paragraph.
In the actual script, data is read in from the existing inventory list. I then need to insert the new paragraph entry into the list… in numeric sequence by part number. That’s the only remaining problem.
(The amended inventory is then spit out to a new file.)
StefanK’s script allowed me to insert a simple numeric value in an existing list of values and I thought I could take that result and make the full paragraphs of the list ‘follow suit’, as it were. But I’m still (obviously) struggling with that bit.
I guess I should spend some more time studying the examples I’ve already been given… maybe a light will finally go on.
If it ever does, I’ll post the final script.
Peter B.