0

con2str() is handy when you want to turn a small “bundle” of values into one readable line—great for quick logs, debug output, or lightweight exports in a warehouse workflow. In an electronics retail scenario, you might package a few facts about a picking wave or a shipment into a container, then serialize it for a tracking note. Because con2str() produces a single string, it’s a fast way to stash context in an infolog, a custom audit table, or a file you’re going to scoop up later with a script.

A common pattern is: build the container, make sure anything that isn’t already a string is converted (ints, reals, dates), then call con2str(c, "yourSeparator"). The default separator is a comma, but many teams prefer something like | to avoid clashing with item names or notes that may contain commas.

Example 1 — quick audit line (default comma)

// [salesId, workerId, linesPicked]
container summary = ["SO-000423", "WKR007", "12"];
str auditLine = con2str(summary);  // "SO-000423,WKR007,12"
info(auditLine);

Example 2 — pipe-delimited with mixed types (convert first)

// [salesId, linesPicked, cartonCount]  (note ints)
container raw  = ["SO-000511", int2str(9), int2str(3)];
str pipeLine   = con2str(raw, "|");  // "SO-000511|9|3"

Example 3 — building lightweight export rows

container row1 = ["TV-65-ULTRA", "RACK-03", "BIN-12A", "2"];
container row2 = ["SND-BAR-450", "RACK-08", "BIN-05C", "1"];

// You can write each to a text file, one per line, reusing the same separator:
str out1 = con2str(row1, "|");   // "TV-65-ULTRA|RACK-03|BIN-12A|2"
str out2 = con2str(row2, "|");   // "SND-BAR-450|RACK-08|BIN-05C|1"

A couple of practical tips: containers are immutable (functions that “change” them actually return a new one), and con2str() is simplest when all elements are already strings—so pre-convert non-strings with helpers like int2str() before calling it. If you ever need more control over formatting (e.g., quoting, escaping), build the line with strFmt() yourself.


Getting a single value from a container

When you don’t want the whole thing as text—but just one element—use conPeek(c, index) (1-based index) and assign it to the appropriate type.

// [salesId, linesPicked, cartonCount]
container packed = ["SO-000511", 9, 3];
str salesId = conPeek(packed, 1);  // "SO-000511"

That’s it: con2str() for “serialize everything”, conPeek() for “pluck one value.”

Have a Question ?

Fill out this short form, one of our Experts will contact you soon.

Talk to an Expert Today

Call Now

Call Now800-453-5961