Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format text part in colour

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
0
0
GB
I am using CR 2016

O ahve some text data allways dhwoung in this layout and in blue font

xxxx yyyy zzz

Whats the best to allways show the xxxx in red and rest in blue
 
Are you trying to color the first segment red? Or are you trying to color any segment that equals ‘xxxx’ red?

-LB
 
sorry should have made much clearer, its the first segment - should always be 4 characters but to be safe upto the first space
 
Break the field into two sections by creating two formulas:

//{@firstsegment}:
stringvar array z := split({table.textfield}," ");
z[1]

//{@remaining}:
stringvar array z;
numbervar i;
stringvar y;

for i := 2 to ubound(z) do(
y := y + z+" "
);
y

Drop these into a text box, adding one space between. Then right click->format text and select the first segment and format it to red. Repeat for the other formula in the text box.

-LB
 
Hello

sorry taken while t get back

The first formula worked and created correct data xxxx

the second formula returned nothing at all

//{@remaining}:
stringvar array z;
numbervar i;
stringvar y;

for i := 2 to ubound(z) do(
y := y + z+" "
);
y
 
It worked properly when I tested it, but try defining z again in the second formula:

//{@remaining}:
stringvar array z := split({table.textfield}," ");
numbervar i;
stringvar y;

for i := 2 to ubound(z) do(
y := y + z+" "
);
y

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top