Apostrophe (') causing delivery Address not to apper

Hi,

I have come across following bug. What we have noticed is that If there a apostrophe (’) on the address (i.e Street) it does not display under Waiting Orders or Delivered Orders section under Take way department. Apostrophe (’) causing the street name not to appear under street field. However, full address prints correctly on the printer.

If the apostrophe (’) is manually removed from the street name street name displayed as it should.

Additional Information:

<L00><font Bold> Date: {TICKET DATE} </font> <font Bold><color Blue><size 20> <sym>⏲</sym></size> {TICKET TIME}</color></font>   Ticket No:{TICKET NO}  <color Blue><size 30><sym>⛐</sym></size></color> <size 18><color Blue>[=F(TN('{ENTITY DATA:Customer:Distance}'),'0.00')] miles </color></size>  <size 20> <color Red><font Bold><size 28><sym>⏳</sym></size> {TICKET STATE MINUTES:Delivery} Min</font></color></size><br/>
<L00><block 10 transparent left *>
<L00><color DarkCyan><size 20><font Consolas>{ENTITY NAME:Deliverer}</font></size></color><br/> 
<L00><size 20><sym>☎ </sym>{ENTITY NAME:Customers}<sym>         ☎ </sym>{ENTITY DATA:Customer:Mobile}</size><br/>
<L00><font Bold><size 18><sym></sym> {ENTITY DATA:Customers:Customer Name}</size></font><br/>
<L00><sym></sym><size 14> [='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>')]</size>
<L00><size 18> [='{ENTITY DATA:Customers:Town}'.replace('<!rn>','<br/>')]</size>
<L00><size 18>  [='{ENTITY DATA:Customers:PostCode}'.replace('<!rn>','<br/>')]</size>
<L00></block>
<L00><block 10><size 20>£{TICKET TOTAL}</size></block>

You have this:

[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>')]

Try this:

[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, "\\'")]

If that works, you might want to do the same thing with the Town.

i have tried that still same result.

<L00><sym></sym><size 14> [='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, "\\'")]</size>

Try replacing it with nothing:

[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, "")]

still same

Difficult to say for sure due to size and quality of screenshot, but the replacement value does not look empty. It looks like there is a single-quote in there, like:

.replace(/'/g,"'")

Be certain that ^ is not the case. You can do it this way too (try this - using single-quotes instead of double):

[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, '')]
i have double checked and below is what i have tried and results are same.
   
<L00><sym></sym><size 14> [='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, '')]</size>

<L00><sym></sym><size 14>[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/'/g, "")]</size>

Ok, not sure then.

I am curious to know now, what the Query Field Type is and does, that is, how the value is retrieved and what the direct results are.

For example, if Query means “Select from Database”, then the return for Mary's could very well in fact be Mary''s (2 single-quotes), because SQL escapes single-quotes by using 2 single-quotes.

If that is the case, you might try:

[='{ENTITY DATA:Customers:Street}'.replace('<!rn>','<br/>').replace(/''/g, '')]

Ok, this is not a DB query. It is a lookup from an associated CSV file, which is not specified in your case, so it could probably changed to a String Field Type, but wouldn’t have any effect anyway…

Reference:
https://www.sambapos.org/wiki/doku.php/en/how_to_integrate_sambapos_to_post_code_databases

You might still try the last replace code I gave anyway just to see if it affects anything.

Damn, just thought of something. I think the .replace is happening too late. The data is already messed up before we even get that far. Try this - notice the double-quotes around the data tag!

[="{ENTITY DATA:Customers:Street}".replace('<!rn>','<br/>')]
  ^                              ^
1 Like

Thank you, You are star!!! Much appreciated

Replacing with double-quotes around the data tag fixes it.

[="{ENTITY DATA:Customers:Street}".replace('<!rn>','<br/>')]

Additional information:
The address was retrieved from google map when post code is quaried.

1 Like