advanced rule in smartstream designer


New member
I need some help to create an advanced rule in smartstream designer.
In my database, I have ‘codes’ - example: ABCBBA or CBAAAC or BACAAC
This code fills in the color for 6 rectangles in InDesign: A=red, B=blue, C=yellow

I try to build an advanced rule for this. I tried to use the ‘substring’ function.
But I can’t figure out how it works. (I’m not really a coder)

Any suggestions?




Well, I'm not sure if you can apply a style rule to a rectangle color in SmartStream. That's probably where I'd start. If you can do it, then you can make your life easier by breaking that column into 6 different columns using a tool like "text to columns" in Excel. That would mean you can avoid using the SUBSTRING method. If you can't, then you're right on track.

My documentation is out of date, but SUBSTRING seems to work like this:
SUBSTRING(string,start) or

If FIELD("Code") == "ABCDEF"

SUBSTRING(FIELD("Code"), "1", "2") == A
SUBSTRING(FIELD("Code"), "2", "3") == B
SUBSTRING(FIELD("Code"), "3", "4") == C
SUBSTRING(FIELD("Code"), "4", "5") == D
SUBSTRING(FIELD("Code"), "5", "6") == E
SUBSTRING(FIELD("Code"), "6", "7") == F

It seems that the character index for the start position starts at 1 and it expects a string.

Once you have those values isolated, you can wrap them in IF/Elses.

So start by verifying if style rules can effect rectangle fill colors, then see if you can break that column up to avoid that mess.


Well-known member
I'm not a coder either, but I use SmartStream extensively. I don't think that SmartStream can use a substring on the IF statement.

Is there any way you can have the data split into 6 different columns? So instead of one column reading ABCBBA, you'd have one column (Box1) A, next column (Box2) reads B, next one (Box3) is C, etc. Then you would write a separate rule for each of the 6 boxes, with the only difference between them being which field is driving that particular box.

edit - looks like gabrielp was posting his response as I was typing mine. If you can't apply a style rule to a rectangle color, you could always cheat by using variable graphics that are the colored boxes.
Last edited:


New member
Thanks for the suggestions. I'll see what works best.

I usually work with XMPie uDirect. In my opinion, uDirect is a lot easier (for non-coders) to build complex rules.



What About Profitability?

What about Profitability?
Offset yields new advantages

Read All About It