I don’t need someone to solve this for me, just point me in the right direction:
I have a field that will be in the form of an array like this:
a,b,c;d,e,f; etc. I want to display the contents for each record in a columnar list like this
a b c
d e f etc.
I know how to make a text list in which the columns contain different fields for all the (or the selected) records in a DB. What I can’t yet figure out is to make a list out of this field from just one record, to display on a form displaying that record.
An extra bonus would be that if any of the array elements were a number I could sum it at the end. I think that would involve extracting that element from the array in the field, converting it to a number, etc.
So it seems like my question is about dealing with an array that is a constant within a field rather than constructing one from the whole DB (or a selection within it).
I’ll appreciate any hints that put me on the right track; it seems that this should be pretty simple.
I finally had time to get to this, and once I understood all its elements, it does exactly what I need. Along the way I’ve learned a lot, having to convert from Jim’s example to my actual situation rather than just pasting in a recipe. Thank you, Jim, for your teaching!
I can cobble up a quasi text list using the replace( function as Jim Cook suggested in his first reply; but I’d really like to use a text list object so I can format it nicely with alignment tags and so on. I fooled around a lot with arraycolumn( but that gave me just one line in the TLO with, for example, all the dates in one TLO grid space separated by ;s, and all the amounts in a second grid space, also separated by ;s, etc. I tried replacing various things with cr() or paragraph symbols, but I can’t figure out how to get the successive rows of the array into successive rows of the TLO as if they were different records in a db.
To display this data in a Text List object you need to replace the semi-colons with carriage returns and the commas into tabs. In Panorama X, one replace( function can do both of these replacements with one function, like this:
replace(... data formula ...,";",cr(),",",tab())
Of course, there must be no commas or semi-colons in your data, but I assume you’ve taken care of that or you would have other problems.
I thought I understood this, but apparently I don’t. The array I am trying to display comprises the contents of a field called Target. My most recent question shows the first two “lines” of that array. From Jim Rea’s reply I assumed that the TLO would be displaying a 2 dimensional array, the columns of which are separated by tabs and the rows of which are separated by cr’s. If that were true, it would obviate the necessity of using any array functions at all on the data in the field, which seems logical, since the field contains a 2-D array to begin with.
If I use the formula replace(Target,";",cr(),",",tab())
in a TDO, I get such a display (but without the possibilities of tag formating); but if I use that formula in a TLO, I get the first line of the field (that is, the values up to the first semicolon) in three columns on the first line of the TLO, and nothing at all on any of the subsequent lines, where I expected the second and subsequent originally ;-delimited elements.
Obviously my assumption is wrong.
Can someone straighten me out?