Separators & Text Lists


#1

I need some clarification, please.

In a Text List Object (TLO) inspector, what values can occupy the separator (“Sep”) option in both the “Selected Value” and “Content Data” areas.

image

Can multiple characters be used? What about a variable? I’ve tried these and not had much success. I’ve also tried various chr(xxxx) values without success.

In other circumstances I’ve used the default character (which appears to be tab()), but now I have a field which contains both tab() and cr() characters. I’d like to tease that field out of the TLO’s selected value, but cannot.

Thank you,

Eric


#2

Here is my own personal help page for the TextList Options Pane. It has been almost three years since I created this and I have not checked it recently to make sure nothing has changed, but I think it may answer your questions. I tried putting a variable in the Selected Value separator, but it is treated like a string of text so the variable name appears as the separator. So for first Sep box, I don’t think a variable can be used.


#3

Tom,

Thank you! It is most helpful and clarifies the TLO nicely.

One more question: If a field in a TLO contains tab characters, how can that entire field be teased out of the returned Value variable? This seems to not be possible, given that the tab character is used in the TLO’s Formula pane to separate the provided data into columns.


#4

Since I created my little help sheet, Jim has added extensive information to Panorama Help, which you can find on the Text List Object page of the help system. If I understand your question, when you select a row in your text list object, the row is placed in the variable you put in Value in the first row, in your example choice_FieldPicker. Use the array function to retrieve an item from that row. For example,

array(choice_FieldPicker,3,tab())

will retrieve the third item of that row, assuming tabs are separating the items in the row. My example assumes that Database Navigator is not selected, If it is, then the Value variable is ignored by Panorama.

If Database Navigator is checked, then you can directly access the data with the field name. The row selected in the text list object is synchronized with the row in the Data Sheet.

You asked what happens if a field has tab() characters. If you have Database Navigator checked, my testing showed that a tab() in the data will cause the misalignment of the data in the text list object. However, you can replace the tab() with other characters, such as four spaces, which will preserve the correct alignment in the text list object. You would put in the Formula for the text list object something like this, where A, B, and C are the field names:

replace(«A»,tab(),"    ")+tab()+«B»+tab()+«C»

You could do the same with any other characters that you want to modify in your data.

If you are using an array to display the data, then you would have to replace the tabs in the data when you create the array.

Finally, even though I have used a lot of text list objects, I admit that I don’t understand what the second separator box does in the Test List Pane, nor can I find it in the Help System. Hopefully somebody else will tell us.


#5

Tom,

This works but the spacing of the tab and a fixed number of spaces often doesn’t match.

The only way I can see allowing unchanged data to be passed from a selection in the TLO, is to have a unique ID (GUID) associated with each data record. This would allow one to do a lookup in the source database or array, finding the associated record and obtaining the unchanged tab-containing data field. That means searching the data a second time, since the TLO essentially has done it once already, courtesy of the users selection.

It would be very nice if the TLO would allow a unique separator (preferably more than one character in length) to be used in the Formula pane, which could also be used in the Options pane or elsewhere, to parse the data, after it is selected. This would help preserve data formatting within tab-containing fields. Is that something which is useful, possible or likely, Jim?


#6

If your formula is an array with a separator other than a return you can enter the separator to use with that formula. For example if you use this array as the formula:

"Gold****Silver****Copper****Tin"

You would use **** as the separator and result in the Text List showing:

Gold
Silver
Copper
Tin

As you can see from the above example, in Panorama X you can now use separators with multiple characters in all array situations.


#7

Gary,

Thank you for the explanation. Does this approach work with a “multicolumn” array? My difficulty stems from a TLO with multiple columns, one of which contains text data that contains tab characters.


#8

As far as I can tell only the tab separator will work to separate columns. Your text containing tabs will have to have the tabs changed to something else for the Text List Object and then reconverted back to tabs for the selected data when output.


#9

It sure would be nice to be able to have the user determine the column separator for the TLO, much like its record separator can be customized. That would make working with tab characters in data fields much easier.

In the interim this is my solution, where each record in the database or array used for the TLO has a GUID which is used as the last element in the TLO Formula. The following code is placed in the TLO’s Procedure tab, which allows the tab-containing data to be placed in the variable tab_Data:

local theGUID
// tab_Data (a window- or fileglobal variable) used in a text editor or text display object to display the tabbed field's data.

theGUID = array(TLOselectedValue_variableName, -1, tab())

tab_Data = lookup("TLOsource_Name", "TLOsource_GUIDfieldname", theGUID, "TLOsourceFieldName_containingTAB_Data", "ERROR", 0)

showwindowvariables tab_Data

This allows the tab-containing data field to be displayed without any alterations. My only concern is this could be a bit slow on large databases as it requires a second lookup of the data.


#10

Gary is correct, only the tab can be used as a column separator.

Gary’s suggestion of changing the tabs to something else is easily accomplished with the replace( function. Eric asks that the Text List object be enhanced to allow separators other than tab, but if that would work for you, then the replace( function will also, something like this:

replace(textlistdata,tab(),"   ","YOURSEPARATOR",tab())

I replaced the tabs with three space, but you could use whatever you want.

Chances are you really don’t need a GUID to find the data you are looking for. Panorama can do searches and lookups on multiple fields (using superlookup(), or even all fields. So unless your database contains multiple records with ALL of the fields duplicated, you don’t need to create an explicit GUID.

Another possibly useful tip – the data you pass to the Text List can have more columns than are shown in the list. So you can put extra stuff on the end of each line that isn’t displayed on the list, but that CAN be accessed when the user clicks on a list item.