Longest string of ALL cells of a table.

5060
14
08-26-2014 01:52 PM
AlexZhuk
Occasional Contributor III

I need to find the longest string of ALL cells of a table. Unfortunately, the table can have varying number of fields each time. Is it doable?

0 Kudos
14 Replies
IanMurray
Frequent Contributor

I'd recommend probably splitting it up into two seperate strings, each with a maximum string length.  So your first string I guess you need left justified for the value of field one, with a max length of x(x being longest string in field) then concatenate that with a second string for the values of field two justified rightwith max length of y(ditto)(Since  you mentioned you wanted similar to the example you posted).

0 Kudos
AlexZhuk
Occasional Contributor III

This is more or less what I've been trying to do, but I still need the max length of the values, as well as max length of the field names. Otherwise I (and my other users) will have to calculate the numbers manually. I want to avoid it.

By the way, this kind of labels are called "spider diagrams" and are popular in the environmental industry, whether we like them or not.

0 Kudos
curtvprice
MVP Esteemed Contributor

Seems to me an approach that has a better chance of working is to to determine a label expression from your data and update it into the layer object rather than attempting to do all this processing in the labeling context.

Or maybe I'm missing what you are doing again?

BTW, see Posting Code blocks in the new GeoNet

0 Kudos
AlexZhuk
Occasional Contributor III

The data come from a SQL Server DB, where I have no control, and can't create extra columns, etc. So the processing has to happen on the label side, for better or worse. The tables are different every time, as the number and name of fields.

0 Kudos
AlexZhuk
Occasional Contributor III

Robert, I added a few notes below.

0 Kudos