"." in query string messing up - mysql

I was working with queries that the data is being used for the meta description.
UPDATE cards SET meta_description = 'Amy\'s bugs address labels are printed on recycled label paper. Available in quantities of 30. Each label is 2.5 x 1 inch with rounded corners.' WHERE card_id = 'al007'
I have noticed though that the period after paper is shortening the meta description to just "Amy's bugs address labels are printed on recycled label paper." If I remove the period the entire description will show up then. Does anyone know how to solve this tiny dilemma?

I'm pretty sure that the issue is in whatever place you see the results. Most likely, there's a line feed after the period and your device does not support/show multi-line data. When you remove the period, you probably remove the carriage return as well.

Try escaping the period with '\'
Since you say, by removing period, the whole sentence is getting updated, I assume there is no problem with the column size.

Related

How can I create a date field by HTML5 Pattern (DD.MM.YYYY)

I have that code:
(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))
Checks that
1) the year is numeric and starts with 19 or 20,
2) the month is numeric and between 01-12, and
3) the day is numeric between 01-29, or
b) 30 if the month value is anything other than 02, or
c) 31 if the month value is one of 01,03,05,07,08,10, or 12
It's from page http://html5pattern.com/Dates
I tried to move some part of code, but then this code doesnt work... Even I tried to find some instructions how can I do it. But I can't handle with it...
How can I get a result like with above code but in format:
DD.MM.YYYY
Also is there any possibility to add the dots in field that user can only input the numbers without dots?
(I mean that the dots will be there every time)
Thank you for help.
Sorry for my English.
I think this is something that you are looking for:
(?:(?:0[1-9]|1[0-9]|2[0-9])\.(?:0[1-9]|1[0-2])|(?:30)\.(?:(?!02)(?:0[1-9]|1[0-2]))|(?:31)\.(?:0[13578]|1[02]))\.(?:19|20)[0-9]{2}
Also tried some possible test cases and worked fine:
You can use an input mask plugin for some of what you are asking for instead I suppose.
One popular one that comes to my mind is Robin Herbots: https://github.com/RobinHerbots/Inputmask
You can find demos off his page here: https://robinherbots.github.io/Inputmask/index.html
Once you implement the plugin into your page, then it's just a matter of establishing the right input tags and jquery for them. For example:
Your phone number script would then be something along the lines of:
<script type="text/javascript">
$("#Phone").inputmask({mask: "999.999.9999"});
</script>
You should look up the documentation for it.

Way to add a calculated number of X's to a form input?

I have certain product codes with varying number of letters/digits e.g. 53HD6J, HH88WBD3 (varies between 5 to 10 letters/digits). In order for our barcode to scan these correctly there has to be 13 letters/digits. I don't want to make the user to input -XXXX after each code but rather have Access calculate the difference between 13 and the length of the code and fill the remaining with a X's. Is this possible either by vba or and expression?
I currently am using about 6 IIFs in one formula to fill remaining blanks with X's but hoping there is an easier way.
I have a form to enter in the batch number (product code). Once that form is submitted it links to a report that is printed. On the report are those batch numbers (53HD6J, HH88WBD3). The spot I want to have this feature is in a text box right next to the codes where Access determines the length of the codes and computes the remaining X's to add. This is in barcode font so this text box is where the 53HD6JXXXXXXX would go. Hope that clears it up!
So I have that part figured out. My problem now is my barcode font reads the text no matter what and translates it still so barcode shows up when the batch number is blank (I have four spots for batch codes to be inputted). So what I had before was =IIf([Text31]="",""&[Text31]&"","") which seemed to work. Hopefully I can continue this with the new formula. If that's unclear let me know.
**(The "" & & "" is so the barcode can be scanned).
My formula was wrong right above with the IIf. I figured it out! Forgot I had used ' Like "*" '. Thanks!
You can do what you want with String() and Left().
Here is an example from the Access Immediate window:
product_code = "53HD6J"
? product_code & String(13, "X")
53HD6JXXXXXXXXXXXXX
? Left(product_code & String(13, "X"), 13)
53HD6JXXXXXXX
Based on the update to your question, I think you can use that approach for the Control Source of a text box where you want to display the "expanded" product code.
Pretend your report has a text box named txtProduct_code where the raw product code, such as 53HD6J, is displayed. And there is a second text box where you want to display that value with the required number of X characters (53HD6JXXXXXXX).
Use this as the Control Source property of that second text box:
= Left([txtProduct_code] & String(13, "X"), 13)
Alternatively, you could make it a field expression in the report's Record Source query.
SELECT
product_code,
Left(product_code & String(13, "X"), 13) AS expanded_product_code
FROM YourTable;

How to get the real height of a character (fontmetrics/graphics2d)

I am currently in need to get the real height of a character. I am aware of the functions like getDecsent(), getAscent(), ... but they only allow to get values regarding the hole font (in its context). I also tried the way using getStringBounds(), but that is the same story.
Like the title says, I am looking for a way to get the height value of just one char at a time.
For example 'N' is higher then 'n', 'I' just a little bit higher then 'i' and so on
Thanks for your time
Use this
Rectangle2D bounds = font.getStringBounds("put your string here", context);
//font can be set to whatever you want
//my suggestion is that you use the same font for both characters
//context is a object of FontRenderContext
System.out.println(bounds.getHeight());
//Instead of just printing it you could do this a second time and compare the 2 strings

MS Access VBA Cross tab report legend sort order

The problem is hard to explain ,
I have an access report with a stacked bar chart to show the percentage fills over time like the one in this example : Click here
The legend for the chart i have is a number followed by the name, for e.g
1-Mango
2-Apple
3-Banana
etc
I want to sort this according to the above format but when i have more than 10 items the 10-Pineapple comes before 1-mango when it should appear after 9-somefruit .
The underlying query for the access report uses a Cross Tab query in which the items are created as
Column heading:[PrefixPriorityNumber]&"-"&[FruitName]
I even used the Sort:Ascending but it still doesnt affect my custom ordering that i wanted to show.
I also tried to google "sorting alpha numeric strings" but this is clearly more than that.Any assistance is appreciated
The problem is you are getting a text sort. You need to format the prefix number.
Column heading: Format([PrefixPriorityNumber], "00") & "-" & [FruitName]
Either use another digit, as Remou suggests (01 instead of 1) or start using letters. A > 9, B > A, etc.

How do I best display CheckBoxes in SQL Server Reporting Services?

One of the many quirks of Reporting Services we've run across is the complete and utter lack of a CheckBox control or even something remotely similar.
We have a form that should appear automatically filled out based on information pulled from a database. We have several bit datatype fields. Printing out "True" or "False" just looks silly, as this is supposed to look like a form that has been auto-filled out, so we want to have a series of checkboxes and labels that are either checked or unchecked.
We are running SSRS 2005 but I'm not aware of SSRS 2008 having added a CheckBox control. Even if it did, we'd need to have an alternative for the time being. The best we've found so far is:
use Wingdings
use images
use text boxes with borders and print a blank/space or a capital X
All three approaches require IIF expression shenanigans.
The Wingdings approach seemed to work acceptably, and was the most aesthetically pleasing except that for whatever reason it didn't always print correctly. More importantly, PDF exports, also for whatever reason, converted all fonts (generally) to Arial and so we got funky letters instead of the Windings dingbats.
Images, being a pixel-based raster, don't do so well when printed along side vector stuff like text. Unless handled carefully, they tend to stretch, pixelate, and do other unprofessional looking things.
While these methods do work (some with limitations as mentioned above) none of them are particularly elegant.
Are we missing something obvious? Not so obvious? Does someone at Microsoft have a good reason why such a control was not provided in SSRS 2000, let alone 2 versions and 8 years later? This can't be the first time this issue has come up...
I, along with others in my shop, have used images, toggling the hidden attribute based on the field value (true or false). We haven't had any problems with blurring or scaling, unless we tried to increase the scale of the image beyond 100% obviously.
Another option I've used is similar to the wingdings idea, but I just use a plain old "X". On our forms at least, it is not uncommon for someone to use an X in a box instead of a check mark, so it looks completely acceptable. Plus, you don't have to worry about strange characters when printing.
As for why Microsoft does not include a checkbox control, I can't answer that as I've been wondering the same thing myself for a long time now.
I just wanna share the idea on this blog. SSRS: How to Display Checkbox on Report
First create a textbox
Then change the font family to Wingdings
Insert an expression on the textbox and write this expressions.
=IIF(Fields!Active.Value,chr(254),"o")
Fields!Active.Value could be anything from your query that should return a boolean value 1 or 0.
Then click Preview and see the checkbox ;)
More styles can be selected on the blog that I shared above.
Here is an example of my output
What I have used to display a check box (or ballot box):
1- create textbox (that will become your check box)
2- change font to Arial Unicode MS
3- in the expression window use:
ChrW(&H2611) for a filled-in checkbox
ChrW(&H2610) for an empty checkbox
Besides the different methods already presented, as of SQL Server 2008 R2 there's a built-in control that can be used for checkbox-alike functionality: the Indicator!
Have a look here for details on how to use it: https://web.archive.org/web/20190916105459/http://blog.hoegaerden.be/2012/08/04/displaying-checkboxes-in-an-ssrs-report/
To be able to use a field of type bit, you'll have to cast it to int first. This can be done either in the dataset query or by adding a calculated field to the dataset.
If you want the NULLs to come up as yellow, then you'll need to build the expression that way so it takes that requirement into account as well.
Here's a possible expression for a calculated field:
=Switch(
IsNothing(Fields!YourBoolean.Value), 50,
Fields!YourBoolean.Value = False, 0,
Fields!YourBoolean.Value = True, 100)
Depending on the meaning of your fields - is False good or bad - you may need to swap the zero and 100.
Another way to do thisd is go to "Placeholder properties" of TextBox and check Html - Interpret HTML tag as styles
Then in the Value - Expression put this line of code for checked:
="<font face=""Wingdings 2"" color=""green"">" & Chr(81) &"</font>" & "some other text"
Or this code sample for unchecked:
="<font face=""Wingdings 2"" color=""red"">" & Chr(163) &"</font>" & "some other text"
This way you can have checkbox and text in the same textbox.
Later edit:
If you are having problem displaying Wingdings 2 on Azure, then use Wingdings.
Apparently it works.
="<font face=""Wingdings"" color=""green"">" & Chr(253) &"</font>" & "some other text"
Or this code sample for unchecked:
="<font face=""Wingdings"" color=""red"">" & Chr(168) &"</font>" & "some other text"
You can also use a string calculated field like "[X]" or "[ ]". It's less pretty than the textbox with border but you don't have to put a specific control for the value and you can fill table or matrix with this.
At least there is some solution for the checkbox. I'm still looking for full justification for my text (In fact I'm looking for another solution than SSRS know).
ACCESS 97 could make this kind of thing but not SQL SERVER 2012.
I think there is a bug with SSRS and embedding font characters above 128 (some thing todo with ANSI encoding). Basically you can use 1-128 fine, the rest show up as tall rectangular blocks.
I like NY's idea of the textbox with a border and an optional X - this sounds simple and effective.
This is building on Dragos Durlut's answer. I don't have a high enough reputation to comment but I can answer...
I needed a checkbox as part of text that is passed as a parameter. The parameter contains HTML and is used in a placeholder set up just like Dragos suggests: HTML - Interpret HTML tags as styles.
Instead of having to switch between the HTML and the strings, you can use the HTML Escape Codes (& + # + CharCode + ; --> ¨)
="<font face='Wingdings'>¨</font> Empty checkbox"
Since mine is a parameter, it just pass in the string:
<font face='Wingdings'>¨</font> Empty checkbox
If you need the checkbox selected, you would pass in either ý or þ instead:
<font face='Wingdings'>ý</font> filled with an x
<font face='Wingdings'>þ</font> filled with a checkmark