How to escape a percentage sign
I have a simple one line MySQL command that I want to run from AppleScript.
The command itself is
UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE "% DATE %" ;
Unfortunately, every time I run it I get some error or improper result.
I've tried escaping out the quotes and percentage sign with a backslash, using "quoted form of" statements, parsing out individual words and using "quote" operators, using curly quotes, and even substituting "ASCII character 37" or "character id 37" for my percent symbol. Most often I get backslashes before my quotes. Here is a recent example.
Code:
set part1 to "UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE "
set part2 to " DATE "
set part3 to " ;"
set convertDate to part1 & quote & (ASCII character 37) & part2 & (ASCII character 37) & quote & part3
return convertDate
Result:
"UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE \"% DATE %\" ;"
I know I can always call a 1 line shell script, but I hope there is a simple solution.
Quote-Mania
mabye this example helps:
do shell script "echo UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE \"% DATE %\" >~/Desktop/testoutput.txt"
do shell script "echo UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE \\\"% DATE %\\\" >>~/Desktop/testoutput.txt"
the result in Skript-Editor looks like
"UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE % DATE %
UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE \"% DATE %\""
when you open that text file now you will see
UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE % DATE %
UPDATE exif SET datevalue = tagvalue WHERE tagname LIKE "% DATE %"
Just keep in mind, that the result of a script could be directly inserted into another script, so the output will be quoted if needed to make this possible.
Similar Messages
-
How to display a percentage sign ( % ) after a text box in a screen
hi experts,
Can anybody tell me how to display a percentage sign ( % ) after a text box in a screen.Hi Ajay,
Try to use the [Position|http://help.sap.com/saphelp_nw04/helpdata/EN/9f/dba7e235c111d1829f0000e829fbfe/frameset.htm] option of selection screen.
By using this you can place the text as a comment at a desired position on the selection screen.
The syntax would be like this :
SELECTION-SCREEN POSITION <pos>.
Regards,
Swapna. -
Hi All,
How to display the percentage sign in the planning form in an account..?? I've an account that already set as the percentage for the data type.
What I want is, when I type 50 in my cell, then in my form will be show 50%
Now, I can't see the % sign on my form.
Any Idea..??
Thanks.
Regards,
VieNI know it's an obvious one but has caught me once or twice before when I've changed many properties numerous times in one day: Make sure you've deployed since you last set the properties!
-
How to display a percentage sign in calculated member column?
Hello all,
in my report I have a calculated member column whose value is determined by follwing value formula:
if CurrentColumnIndex - 2 = 1 then
If GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex) = 0 then
0
else
(GridValueAt(CurrentRowIndex, CurrentColumnIndex-1, CurrentSummaryIndex)/
GridValueAt(CurrentRowIndex, CurrentColumnIndex-3, CurrentSummaryIndex)) * 100
else
If GridValueAt(CurrentRowIndex, CurrentColumnIndex-5, CurrentSummaryIndex) = 0 then
0
else
(GridValueAt(CurrentRowIndex, CurrentColumnIndex-1, CurrentSummaryIndex)/
GridValueAt(CurrentRowIndex, CurrentColumnIndex-5, CurrentSummaryIndex))*100
Returned is a numeric value and it is being correctly displayed in calculated member column. As the value should represent percentage, I need to display a % sign after every value.
How would I achieve this? I have seen a thread here in the discussion where approach with a formula and DisplayString function is mentioned - but there are no details how this could be achieved....
The crosstab in question looks like this:
Calculated Member is based on "REV_TOTAL" group column.
I also attached the .rpt file (renamed to .txt for upload)
Many thanks in advance,
MarinHello Raghavendra,
thanks for the quick reply.
Unfortunately it is not as easy at it seems - calculated member column is not showing in report designer and I can not apply the suggested approach with formatting toolbar...
The column only shows here (right click on table -> "Advanced Calculations" -> "Calculated Member...") and there is no possibility to format it directly:
Any other suggestions?
Many thanks,
Marin -
How to add a PERCENTAGE sign to the formula
I was using %A in a fomula to calculate variance %age.
Because %A is based on absolute value that eliminates the sign it wont work for us.
I am planning to do direct calculation without %A to calculate pecent varaince but then I lose the % sign from the cell.
I am sure you can help.
I need to calculate %age and then also display % sign in the cell. For example the cell should show 20.00 % not just 20.00.
If I get a prompt reply not only I will be thankful will also give full credit.Hi Ram,
you can display the % sign in the query report
In the formula select , instead of using percantage share , I think you can use either try with (%CT) or (%GT) and this will be available in percantage functions
I have done for one my report and able to display % sign.
kindly try with the above options if not able to achieve then let me know, I will provide the step by step doc.
thanks -
How to conditionally put a percentage sign in a column in a report
Background: In the past, our users have been provided with a spreadsheet of statistics that was created manually, by running a bunch of barely related queries, manually entering the data into the spreadsheet, adding formatting and headings, etc. They wanted this moved to APEX, and they wanted to be able to export it as one spreadsheet. The only way I could find to do this was to combine all the queries into one huge query.
So I have a report of 22 unique queries unioned together. The third and fifth columns are percentages. I found Column format with percent ( % ) sign post that explained how to use the HTML Expression (under Column Attributes) to add a percentage sign (#COL03#%).
This worked fine except for that in order to get the headings how they wanted them, I had to do something like:
-statistical query-
union all
select '<b>HEADING ONE</b>', null, null, null, null from dual
union all
-statistical query-
etc.
The problem now is that I don't actually want the percentage sign in the heading rows. Is there a way to change the HTML Expression so it's conditional, and it only appends the percentage sign if the value in that row is not null? Or alternately, is there a way to append the percentage sign in the actual select statement, so I could go through each of my 22 queries and append it only when I know it's needed? A simple example of one of these queries is:
select ''New Enrollees'' as a,
(count(case when extract(month from rdate) = :P45_MONTH_SELECT THEN 1 else NULL END)) as monthly,
(((count(case when extract(month from rdate) = :P45_MONTH_SELECT THEN 1 else NULL END))/:P45_TOTAL_MON_SUBMISSIONS)*100) as m,
(count(case when extract(month from rdate) <= :P45_MONTH_SELECT THEN 1 else NULL END)) as YTD,
(((count(case when extract(month from rdate) <= :P45_MONTH_SELECT THEN 1 else NULL END))/:P45_TOTAL_SUBMISSIONS)*100) as y
from main
where extract(year from rdate) = :P45_YEAR_SELECT
Thanks in advance for your help!
-Gaso
Edited by: gaso on Feb 4, 2009 1:39 PM
Edited by: gaso on Feb 9, 2009 4:39 AMwhy don't you add the percentage sign in the query itself, e.g. with a case statement to show it conditionally?
-
Hi All,
I have made one formula which calculating percentage.
I am getting right value of that formula.
Ex.
A=50, B=100
formula: A/B*100 And answer is : 50
Now i want to display this 50 as 50%.
How can i add this % sign with this value?
Regards,
RIshitHi Shantanu & Rakesh,
Thanks for your earliest reply.
But i cannot modify formula.
Because i have used this in Cell Reference formula, in my report there are minimum 100 formula.
Please suggest any other way?
Thanks & Regards,
Rishit -
How to escape the special character ' (ascii 39) in a select query?
Hi,
does anybody know how to escape the special character ' (ascii 39) in a select query?
I've tried a lot of ways but nothing seems to work, for example I try to get all
names in table foo where coloumn name contains a '-sign (ascii 39)
select name from foo where name like '%\'%';
select name from foo where name like '%{'}%';
select name from atg_horse where name like '%chr(39)%'
... but neither works, I end up with a ORA-01756: quoted string not properly terminated
I would apriciate any help
/Carl-Michaelfriends
thanks for ur time and effort that u gave to reply to my problem.
But my main problem is that when my application (VC++ 7) fires the following query in the oracle database , it does not return any rows.
SELECT count(*) FROM ORGANISATION WHERE UPPER(ORGANISATION.ORGANISATIONNAME)
LIKE N'β%' ORDER BY ORGANISATION.ORGANISATIONNAME
the above question in the previous thread was just to check on sql plus as it's editor does not support unicode characters. -
How to escape the special character ' (ascii 39) in a query
Hi,
does anybody know how to escape the special character ' (ascii 39) in a select query?
I've tried a lot of ways but nothing seems to work, for example I try to get all
names in table foo where coloumn name contains a '-sign (ascii 39)
select name from foo where name like '%\'%';
select name from foo where name like '%{'}%';
select name from atg_horse where name like '%chr(39)%'
... but neither works, I end up with a ORA-01756: quoted string not properly terminated
I would apriciate any help
/Carl-MichaelUse two single quotes inside your literals to represent one single quote.
For example, this would find my name:
SELECT *
FROM emp
WHERE name = 'Michael O''Neill';
Michael O'Neill
(acutely aware of the apostrophe issues in the world) -
How to escape a single quotes from a string of dynamic sql clause?
if a single quotes exist in a dynamic sql clause for a string,
like
v_string :='select tname from tab where tabtype='table'',
there tabtype='table' will conflict with the single quote ahead.
could somebody tell me how to escape this single quotes?
thanks for your tips,
frederickfredrick,
To represent one single quotation mark within a literal, enter two single quotation marks. For example :
v_string :='select tname from tab where tabtype=''table'''
Regards,
Srinivas -
How to escape special characters in Simple Transformation
Hi Experts,
I have got a problem to get a well formed xml document from the below simple transformation. The content of maktx contains
special characters like & <, which are not allowed in a well formed XML-Document. But the result of the Simple Transformation
contains this charcters even after the transformation as you can the in the result below. Has anyone a hint how to escape the
characters included in the maktx.
The transformation for maktx, should be something like
Before: Material & < TEST
After: Material & < TEST
Report wihich calls the simple transformation
types:
BEGIN OF t_mat,
matnr type matnr,
maktx type maktx,
end of t_mat.
Data:
mat type t_mat,
xml_stream type xstring.
START-OF-SELECTION.
mat-matnr = '4711'.
mat-maktx = 'Material & < Test'.
CALL TRANSFORMATION ztest_st2
SOURCE mat = mat
RESULT XML xml_stream.
CALL FUNCTION 'DISPLAY_XML_STRING'
EXPORTING xml_string = xml_stream.
Simple Transformation
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="MAT"/>
<tt:template>
<Leistungsschild>
<CHARACT> MATNR </CHARACT>
<CHARACT_DESCR> Materialnummer </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MATNR"/>
<CHARACT> MAKTX </CHARACT>
<CHARACT_DESCR> Materialkurztext </CHARACT_DESCR>
<VALUE tt:value-ref="MAT.MAKTX" />
</Leistungsschild>
</tt:template>
</tt:transform>
RESULT
<?xml version="1.0" encoding="utf-8" ?>
<Leistungsschild>
<CHARACT>MATNR</CHARACT>
<CHARACT_DESCR>Materialnummer</CHARACT_DESCR>
<VALUE>4711</VALUE>
<CHARACT>MAKTX</CHARACT>
<CHARACT_DESCR>Materialkurztext</CHARACT_DESCR>
<VALUE>Material & < Test</VALUE> </Leistungsschild>Hi Sandra,
First of all thaks for your quick answer to my problem.
I see what you mean and get the same result, if I am using data-type string instead of xstring. But the recommendation in the XML-Books of SAP is to use XSTRING to save memory and circumflex problems between Codepages, when writing the XML-Stream to a filesystem.
As you can see in the code abvoe I am using a SAP-FM to display the XML-Stream and this FM works only with XSTRING´s,
that is one reason why I don´t understand that it displays it in the wrong way.
Even the Debugger shows me for the XSTRING the wrong result. Does all that mean that the escaping will not be applyed if you are working with XSTING´s?? -
How to escape % or % in a String?
Hi, friends, I need to use a string variable, but don't know how to escape <% and %> in string, I tried to put \ between < and %, but compiler said it was invalid escape character. and do I need to escape / , too? thanks for any help. the code is here:
<% String sc;
if (request.getParameter("operation")==null) {
sr="/servlet/littleBee_proj.Change_PCServlet?red=<%= request.getParameter("red")%>&
green=<%= request.getParameter("green")%>&blue=<%= request.getParameter("blue") %>&
applique.x=<%= request.getParameter("applique.x") %>&
applique.y=<%= request.getParameter("applique.y") %>";
else {
sr="/servlet/littleBee_proj.Change_PCServlet?red=<%= request.getParameter("red") %>&
green=%= request.getParameter("green") %>&blue=<%= request.getParameter("blue") %>&
applique.x=<%= request.getParameter("applique.x") %>&applique.y=<%= request.getParameter("applique.y") %>&
operation=<%= request.getParameter("operation") %>";
%>
<br> <INPUT TYPE="IMAGE" NAME="applique" SRC="<%= sr %>" >
</FORM>
</BLOCKQUOTE>You won't need the escape characters, because you don't need the <% and %>. You're already inside a java block, so go ahead and take advantage of it. Simply append the method call to your string as you usually would.
<% String sc;
if (request.getParameter("operation")==null) {
sr="/servlet/littleBee_proj.Change_PCServlet?red="+request.getParameter("red")
+"&green="+request.getParameter("green")+"&blue="+ request.getParameter("blue")
+"&applique.x="+ request.getParameter("applique.x") +"&applique.y="
+request.getParameter("applique.y");
}Also, unless you know exactly what you're getting back from your request.getParameter() methods, it's usually a good idea to enclose them with single quotes ( ' ) in case there's a space or something in there. If there guaranteed to be numeric though, then you're probably ok. -
I changed my password to use migration to transfer files from a G4 to a new macbook pro but now I have to sign in every time. How do I avoid the sign in?
I clicked on keychain access but getting a warning that it quit unexpectedly and it won't reopen.
-
How long does this CS6 sign in screen take? It is trying, but dark and not doing anything?
I installed the Assistant, then CS6, think it's working now, I uninstalled it, then tried again. I am running Windows, 64bit on a Dell, I will let you know in a minute. Thanks
Sent from my U.S. Cellular® Android-powered phone -
How do I edit and sign documents using adobe?
How do I edit and sign documents using adobe?
To edit a document you will need Acrobat Pro.
Maybe you are looking for
-
Very urgent- find parent-child relationship for wbs element
Hi, There is a certain parent child heirachy in WBS elements.My requiremnet is to delete WBS element depending on certain field , say depending on some ""status"".If the status is active in some or any of the child then I am not suppose to delete its
-
I try to download an app, and it says that there is an error in the app , Ive tried to download other apps and i get the same error. can someone help?
-
WTB Unlocked Nokia C3-01, preferably a C3-01.5
I am in the US and looking for an unlocked C3-01.5 or a plain C3-01. New or excellent condition only please. Email me at [email protected]
-
Clents from specific site loosing internet access randomly
Hi, this is happening for a while on one of our site. First, here's an overview of our setup The problem is happening on clients of 12.x subnet. So randomly some clients can't browse internet sites. It happens for 30min-1h and then comes back by itse
-
the cd burner software on itunes has gone missing. the computer will no longer grab any cd for intake . a message post ..cd software not found . when i then download cd burner software, i can't open it,because it is not a movie , thats what the drop