Hi Guys,
I'm working with an OpenSource POS system and I need to mod some code. I'm pretty good with CFML, but I don't know much about Java.
When receipts are printed, there is one variable which displays a list of attributes linked to an item on the ticket.
1x Cheeseburger
medium well, no cheese, fries, salad
The attributes are the things under the cheeseburger. The attributes for each item on a ticket are kept within a single column as one string.
aka 'medium well, no cheese, fries, salad'
I can't mod this process of combining it all into one string because it would break too many other things and I don't have the time nor will to dive into it like that. So I'm looking at another method.
There is a line of code in the receipt script that displays this string. The problem is, the receipt is only so wide, and if the attributes string is longer than what can be printed, it just gets cut off. there is no word wrap.
Here is the code that displays the attributes.
<line>
<text align="left"> ${ticketline.productAttSetInstDesc}</text>
</line>
${ticketline.productAttSetInstDesc} is the code that displays the attribute string
I'm not good with Java code. but I understand programming.
What I'm thinking would be the easiest fix would be to simply test if the string is longer than X amount of characters, and if so, break the string into two/three parts, and display them.
aka
#if length(${ticketline.productAttSetInstDesc}) gte 45
#set attributestringA = #first 45 of ${ticketline.productAttSetInstDesc}
#set attributestringB = #second block of 45 characters of ${ticketline.productAttSetInstDesc}
#set attributestringC = #third block of 45 characters of ${ticketline.productAttSetInstDesc}
<line>
<text align="left"> ${attributestringA}</text>
</line>
<line>
<text align="left"> ${attributestringB}</text>
</line>
<line>
<text align="left"> ${attributestringC}</text>
</line>
#else
<line>
<text align="left"> ${ticketline.productAttSetInstDesc}</text>
</line>
#end
Granted, I don't know the syntax to count string characters, etc.. so I just put logic in.
Can somebody look at this and tell me if my logic is ok, and if so, perhaps tell me the correct syntax to make this work??
I'm working with an OpenSource POS system and I need to mod some code. I'm pretty good with CFML, but I don't know much about Java.
When receipts are printed, there is one variable which displays a list of attributes linked to an item on the ticket.
1x Cheeseburger
medium well, no cheese, fries, salad
The attributes are the things under the cheeseburger. The attributes for each item on a ticket are kept within a single column as one string.
aka 'medium well, no cheese, fries, salad'
I can't mod this process of combining it all into one string because it would break too many other things and I don't have the time nor will to dive into it like that. So I'm looking at another method.
There is a line of code in the receipt script that displays this string. The problem is, the receipt is only so wide, and if the attributes string is longer than what can be printed, it just gets cut off. there is no word wrap.
Here is the code that displays the attributes.
<line>
<text align="left"> ${ticketline.productAttSetInstDesc}</text>
</line>
${ticketline.productAttSetInstDesc} is the code that displays the attribute string
I'm not good with Java code. but I understand programming.
What I'm thinking would be the easiest fix would be to simply test if the string is longer than X amount of characters, and if so, break the string into two/three parts, and display them.
aka
#if length(${ticketline.productAttSetInstDesc}) gte 45
#set attributestringA = #first 45 of ${ticketline.productAttSetInstDesc}
#set attributestringB = #second block of 45 characters of ${ticketline.productAttSetInstDesc}
#set attributestringC = #third block of 45 characters of ${ticketline.productAttSetInstDesc}
<line>
<text align="left"> ${attributestringA}</text>
</line>
<line>
<text align="left"> ${attributestringB}</text>
</line>
<line>
<text align="left"> ${attributestringC}</text>
</line>
#else
<line>
<text align="left"> ${ticketline.productAttSetInstDesc}</text>
</line>
#end
Granted, I don't know the syntax to count string characters, etc.. so I just put logic in.
Can somebody look at this and tell me if my logic is ok, and if so, perhaps tell me the correct syntax to make this work??