on 04-26-2018 8:15 AM
we are having a report generated using crystal report While generating we have a request to have a checkbox with a list of items. The checkbox is only available in the Wingdings font. Since we are using Arial font for the list items we can not change the font of the formula field through which we are showing the list. Eg: [] task1 [x] task2
we need to split each list item and replace the square brackets with checkbox form the wingdings font.
how can we create a formula for this in crystal report?
Hi Shahabas,
1. Create a formula with this code:
local stringvar s := {string field}; //Replace this field with the actual database field
local stringvar array s2 := split(s,"|");
local stringvar fs;
local numbervar i;
for i := 1 to ubound(s2) do
(
if s2[i] like '[x*' then
fs := fs & '<font face = "wingdings">'&chr(254)&'</font>' & ' ' & '<font face = "arial">' & Mid(s2[i],instr(s2[i],"]")+1) & '</font>'
else if s2[i] like '[]*' then
fs := fs & '<font face = "wingdings">'&chr(111)&'</font>' & ' ' & '<font face = "arial">' & Mid(s2[i],instr(s2[i],"]")+1) & '</font>'
);
fs;
2. Drag and drop this field on the report > right-click the field > Format Field > Paragraph tab > Under "Text Interpretation" select "HTML Text".
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of Crystal Reports do you use?
Does it work if you were to replace {string field} with a sample text:
local stringvar s := '[]task1|[]task2|[x]task3';
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried it another way and it worked. sorry for the last comment it was my mistake.
But the issue now is that I had intention applied for this field. that does not work now.
I have to display the task in a cell so I had to can grow it.
I need to intent it like,
[] my task
__is to do this(space)
instead of
[] my task
is to do this
stringvar MYARRAY:= Replace ({Notes1},"[]" ,'<font face = "wingdings">'&chr(254)&'</font>');
stringVar MYARRAY1 := ' '+Replace (MYARRAY,"|" ,'<br>');
MYARRAY1;
<br>
Hi Shahabas,
Create a separate formula with the checkbox character - chr(254) and chr(111).
Apply wingdings font on this formula and place it beside the Item field.
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Abhilash,
I cannot do that because I'm actually getting it as a concatenated string with is separated by a pipe symbol. I replace the pipe symbol with space and return so that it showed a list.
Eg:
we get the string like, []task1|[]task2|[x]task3 I need to get this square brackets replaced with the wingdings checkbox.
is there any way that we can add a formula to the font by splitting?
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.