Count number of spaces
Hi,
How do I count number of spaces contain in a varchar2 column?
Thanks
SQL> create table mytable (str)
2 as
3 select 'Test to see how many spaces are in this string' from dual union all
4 select ' Another one beginning and ending with a space ' from dual union all
5 select 'And one containing multiple spaces ' from dual
6 /
Tabel is aangemaakt.
SQL> select str
2 , length(str) - length(replace(str,' ')) "<10g"
3 , length(regexp_replace(str,'[^ ]*')) "10g"
4 -- , regexp_count(str,' ') ">10g"
5 from mytable
6 /
STR <10g 10g
Test to see how many spaces are in this string 9 9
Another one beginning and ending with a space 9 9
And one containing multiple spaces 14 14
3 rijen zijn geselecteerd.Regards,
Rob.
Similar Messages
-
What is the function to count number of spaces in a cell.
Hi Experts,
In Webi, i am stuck with one scenario. The scenario is I have a column named Customer Address. In that i want to know how many "spaces" are there for the each row.
I have created variable and tried using various functions like Count, Substr etc... but those are not appropriate for this scenario. Please Help me.
Customer Address
1400 RamNivas Opp.Croma Circle6 Gurgon
11-88 KPHB Opp.BrandFactory Hyd
1-4-8 ChitrangColony Vijayanthi Chennai
I want output like Below,
Address has to display till second space or till third space or till fourth space........
based on the client decision i will select the address length.Hi Sreeram,
I hope you are talking about Webi here. This is what I would do if I really want to achieve this. I am not saying this is the best way to do. Give it a try and decide if you can achieve the same results by using some other functions. Here is my answer:
Lets assume that our address is "1st 2nd 3rd 4th ".
If your customer decides one space then you will display "1st". if 3 then "1st 2nd 3rd" should be displayed.
The following example formula should display the values before the 2nd space.
=Left([CAddr];(Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))-1)
How it works on "1st 2nd 3rd 4th ":
1. Get the position of 1st space. You will get 4.
Pos([CAddr];" ")
2. Get the remaining string after the 1st space. You will get "2nd 3rd 4th ".
Right([CAddr];Length([CAddr])-Pos([CAddr];" "))
3. Get the position of 2nd space in remaining part of the string. You will get 4.
Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" ")
4. Get the position of 2nd space in the whole address. You will get 8
(Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))
5. Get the string from left until the position of 2nd space. As we will get a leading space we need to subtract 1 from the above formula. You will get "1st 2nd" as result.
=Left([CAddr];(Pos([CAddr];" ")+Pos(Right([CAddr];Length([CAddr])-Pos([CAddr];" "));" "))-1)
All you need to do is replace "CAddr" with your column name. If your customer decides 3rd position, you can edit this formula to add another step.
This formula should give you some ideas to get started with. Let me know if something is not clear.
Sujit. -
How to Count number of words in a file....
Hi Experts,
I have uploaded the text file, from the application server, like this:
call function 'GUI_UPLOAD'
exporting
filename = LV_ip_FILENAME
tables
data_tab = LT_FILETABLE.
The text file contains some number character words.... like "sap labs india..... "
Now, I wanted to count number of words in an internal table LT_FILETABLE.... can anybody help me?Hi,
Special Characters in Regular Expressions
The following tables summarize the special characters in regular expressions:
Escape character
Special character Meaning
Escape character for special characters
Special character for single character strings
Special character Meaning
. Placeholder for any single character
C Placeholder for any single character
d Placeholder for any single digit
D Placeholder for any character other than a digit
l Placeholder for any lower-case letter
L Placeholder for any character other than a lower-case letter
s Placeholder for a blank character
S Placeholder for any character other than a blank character
u Placeholder for any upper-case letter
U Placeholder for any character other than an upper-case letter
w Placeholder for any alphanumeric character including _
W Placeholder for any non-alphanumeric character except for _
[ ] Definition of a value set for single characters
[^ ] Negation of a value set for single characters
[ - ] Definition of a range in a value set for single characters
[ [:alnum:] ] Description of all alphanumeric characters in a value set
[ [:alpha:] ] Description of all letters in a value set
[ [:blank:] ] Description for blank characters and horizontal tabulators in a value set
[ [:cntrl:] ] Description of all control characters in a value set
[ [:digit:] ] Description of all digits in a value set
[ [:graph:] ] Description of all graphic special characters in a value set
[ [:lower:] ] Description of all lower-case letters in a value set
[ [:print:] ] Description of all displayable characters in a value set
[ [:punct:] ] Description of all punctuation characters in a value set
[ [:space:] ] Description of all blank characters, tabulators, and carriage feeds in a value set
[ [:unicode:] ] Description of all Unicode characters in a value set with a code larger than 255
[ [:upper:] ] Description of all upper-case letters in a value set
[ [:word:] ] Description of all alphanumeric characters in a value set, including _
[ [:xdigit:] ] Description of all hexadecimal digits in a value set
a f
v Diverse platform-specific control characters
[..] Reserved for later enhancements
[==] Reserved for later enhancements
u2192 More
Special characters for character string patterns
Special character Meaning
Concatenation of n single characters
{n,m} Concatenation of at least n and a maximum of m single characters
{n,m}? Reserved for later enhancements
? One or no single characters
Concatenation of any number of single characters including 'no characters'
*? Reserved for later enhancements
+ Concatenation of any number of single characters excluding 'no characters'
+? Reserved for later enhancements
| Linking of two alternative expressions
( ) Definition of subgroups with registration
(?: ) Definition of subgroups without registration
1, 2, 3 ... Placeholder for the register of subgroups
Q ... E Definition of a string of literal characters
(? ... ) Reserved for later enhancements
for more details please refer the following,
[http://help.sap.com/abapdocu_70/en/ABENREGEX_SYNTAX_SIGNS.htm]
[http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/902ce392-dfce-2d10-4ba9-b4f777843182?QuickLink=index&overridelayout=true]
Thanks,
Renuka S. -
How to count number of sales orders generated in a month in SAP SD
Hi SD Gurus,
I have a very strange query from client. I have to count the number of sales order created in a month for a z report. For example 30 in Jan, 25 in Feb etc. Could anyone suggest me How to count number of sales orders generated in a month in SAP SD.
Regards
Vinod KumarHi,
Goto the T.Code "SE16" or "SE16n" or "SE11".
Enter the table name as VBAK
Enter the created on date as the starting date of the period and to date as the end date.
Enter.
Click on "Number of Entries".It will tell you the number of entries created in a particular period.
If you want a report,goto the T.Code "VA05n".
Regards,
Krishna. -
How to Count Number of completed line items in past 6 months / 12 months ?
How to Count Number of completed line items in past 6 months / 12 months ?
Hi,
I am trying to count "Number of Completed Line Items in Purchase Order Document" for my Key Figure ZPO_CNT.
Purchase Order document = ZEBELN
Line Item = ZEBELP.
I need to find and count if the Line Item has been received in the past 6 months from today and similarly in the past 12 months.
I have "Delivery Completed" field, ELIKZ.
So, based on this would I be able to calculate it in Query Designer?
If so, Please let me know howHello Deva
If youe want to calculate the completed line item for last 6 or 12 month then i think u will be displaying the query data for these montrhs...create a customer exit to give you date range and restric it in filter area....
Now Choose any of the below option
1. I would suggest to implement an additional key figure "counter" in cube and fill values with one for which delivery is completed.
Now use calculated key figure in Query Designer based on logic
IF counter = 1 THEN counter ELSE 0
OR
2. create a formula variable based on ELIKZ and use replacement path variable, it will display you no. of docs for which delivery is completed....
Award points if it solves your problem
Revert back in case of further assistance...
Thanks
Tripple k -
How to count number of edges using PXIe-6363 Counters
Hello,
I am trying to count number of edges in a test signal in a 50 ms duration. I am using PXIe-6363 card and connecting the test signal to CTR 0 SRC (PFI 8). Is it a correct connection? What else do I need hardware-wise to make a correct set up for this application?
Thanks
Jeet
Solved!
Go to Solution.Hi Jeet,
When you say interrupt signal, do you mean a pulse that will pause your counter task? If that is the case, and you want to pause your task with a digital pulse, you need to use the DAQmx Trigger Property Node and set that to Pause, Trigger Type. As you said, you can connect that signal coming from the chip to any PFI line and then set that line as the source of the property node.
There is an example that you can use that does exactly what I just described. This example is called Count Digital Events-Pause Trig.vi, and you can find it by going to Help>Find Examples..., then on the NI Example Finder window go to the Browse tab and navigate in the folders to Hardware Input and Outpout\DAQmx\Counter Measurements\Count Digital Events.
Regards.
Jorge
Applications Engineer
National Instruments
Certified LabVIEW Associate Developer (CLAD) -
How to count number of raw & put result top of page?
I try to count number of table raw it work fine but when I wont to put result top of page it dose not work
only count one table raw
REPORT ZTEST.
DATA: it_sflight TYPE TABLE OF Sflight WITH HEADER LINE .
DATA counter TYPE i VALUE 0.
start-of-SELECTION.
SELECT-OPTIONS: carID for it_sflight-carrid.
SELECT-OPTIONS: connID for it_sflight-connid.
SELECT * FROM Sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN carID and connID IN connid.
loop at it_sflight .
counter = counter + 1 .
write: /5 it_sflight-carrid,sy-vline,
30 it_sflight-connid,sy-vline,
45 it_sflight-fldate,sy-vline,
60 it_sflight-currency,sy-vline.
ULINE.
endloop.
end-of-SELECTION.
TOP-OF-PAGE .
*START-OF-SELECTION.
WRITE: 'Total Rows : ', counter.
ULINE.
WRITE: /5 'Carrid',sy-vline,
30 'Connid',sy-vline,
45 'Fldate',sy-vline,
60 'Currency',sy-vline.
ULINE.
how can I solve this problem ?Hi
Instead of using counter in a loop use describe statement.
Describe it_sflight.
the no of rows will get populated in the system variable sy-tfill.
DATA: it_sflight TYPE TABLE OF Sflight WITH HEADER LINE .
DATA counter TYPE i VALUE 0.
start-of-SELECTION.
SELECT-OPTIONS: carID for it_sflight-carrid.
SELECT-OPTIONS: connID for it_sflight-connid.
SELECT * FROM Sflight INTO CORRESPONDING FIELDS OF TABLE it_sflight
WHERE carrid IN carID and connID IN connid.
DESCRIBE TABLE it_sflight.
loop at it_sflight .
counter = counter + 1 .
write: /5 it_sflight-carrid,sy-vline,
30 it_sflight-connid,sy-vline,
45 it_sflight-fldate,sy-vline,
60 it_sflight-currency,sy-vline.
ULINE.
endloop.
end-of-SELECTION.
TOP-OF-PAGE .
*START-OF-SELECTION.
WRITE: 'Total Rows : ', sy-tfill.
ULINE.
WRITE: /5 'Carrid',sy-vline,
30 'Connid',sy-vline,
45 'Fldate',sy-vline,
60 'Currency',sy-vline.
ULINE.
Thanks
Rahul jain
Edited by: Rahuljn on Feb 2, 2011 10:58 AM -
Error in query " Value '' of characteristic is not a number with spaces "
Hi Gurus,
I am facing an error in a query with the description:
Error
Value '' of characteristic is not a number with spaces
System error in program SAPLRRK0 and form RSRDR;SRRK0F30-01-
Description
This error is occuring in Production system only, the report is running fine in Development environment.
The error is also visible when I execute it in RSRT, I am not able to find the cause of error through RSRT.
Can anyone please help me with the possible solutions.
Thanks & Regards,
ShreyasHi Juergen,
thanks for the input, I tried to run the report after loading the master data but still there was no improvement.
I am not sure why this kind of problem is rising, some of the similar reports on same infoprovider are running fine.
Please let me know if you know anything about the cause of error.
Thanks & Regards,
Shreyas -
How to count number of ones in table
Hello,
i created one table 16x32 each cell is updating 1 byte of data,how to count number of one in all cell,and is it right way to calculate check sum??
thank youThe simplest way is to call GetTableCellRangeValues with VAL_ENTIRE_TABLE as the range, next summing array elements.
But I don't understand your comment on checksum, so this may not be the more correct method for your actual needs: can you explain what do you mean?
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
URGENT HELP NEEDED: counting number of particles from image
this image on the left is showing particles
hello i want to create a small VI that can count number of particles from a image that i load up. please see the attached image of particles and the VI printshot.
I have used the tutorial "counting number of particles" but still the above VI does not work. it shows the number of particles = 1.. I do not know why it is doing so??
I am not an expert in Labview so please can someone tell me where the problem is. sorry i could not attach the VI file itself but i have given an image of it..
after anyone has solved this problem, i have to create a live system that will get live images from the camera - four frames every sec and the above VI has to count the
number of particles for each frame and output to the user?? is this possible can anyone do it for me???
p.s. in the above VI i read the image from file and count the number of particles. i do not do it to the binary image becuase the binary image is only a black screen
when i run it
thankyouHi Farhan,
Vision Assistant would be the best option to create some steps which you can then export to LabVIEW. You should try using the IMAQ Find Circles.vi. The attached image helps you find the number of circles of an image acquired from a camera. I have used the IMAQdx VIs in this example.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Attachments:
vision.vi 59 KB -
What is a best practice for counting number of payments in Payroll Run?
I'm trying to get a feel for what people are using as a means for counting number of payments being created during a payroll run. I would like to get a total number of checks, direct deposits, wires and zero net checks. My initial thought is to use the Pre-DME number "Selected and Evaluated Persons". This number seems to always match the number of persons "Selected" and "Evaluated" in posting to FI/CO.
Since many companies are restricting use of SE16 and access to many of the BT tables is locked down, I would like to use something that the end user has access to and can easily use. I don't believe the spools from RFFOUS_C and T are appropriate since it would have overflow pages (2 page REM Statements) in that number and thus would not be an accurate reflection of total number of payments.
I would appreciate your insight and thoughts on this topic.
Thanks!Hello Jennie,
This is what we do every payroll:
1. After running live payroll and before exiting our users run wage type reporter /559 to get the payroll net pay. They also run Postings to FICO simulation run to check payroll net pay GL account. This match all the time. So this is the first pass.
2. They finish all subsequent activities in PRD run upto RFFOUS_T.
3. We have developed a custom report which almost looks like REGUH which gives the net pay details by every payment method and amount to be deposited or paid. We match this report from the output we received from step 1.
4. Run postings to FICO live and check the payroll net pay GL account for final validation.
The steps might sound tedious but of a great use.
Arti -
Count number of records in a internal table
hi
i want to count number of records in internal table
pls let me know how to count the number of records in a internal table.
regards
Arorahi
one way is
data field type i.
Decribe table itab lines field.
write: / field.
displays the no of records in tha internal table
or if u want to write logic.
data:
w_count type i.
loop at itab.
w_count = w_count + 1.
endloop.
write: / w_count.
displays the no of records.
reward points if useful. -
Need help to count number of rows and display in file
Hello,
my scenario is IDOC to File......i am using XSLT mapping and using FCC parameters to convert the flat file.
now new requirement is i need to count number of rows and add count value last of the file.
Please let me know how to do it,
thanks in advance for your help.
Regards,
Chinnathanks again, one more Q.
in XSLT mapping i have written for loop for complete structure.
example : <Details>
<node1>
<node2>
</details>
in XSLT mapping
<xsl:for-each select="ZMATMAS_01/IDOC/E1MARAM">
<Details>
</Details>
</xsl:for-each>
if i add the field at target side....then i will come under details node and it will be repeated.
how to declare in XSLT mapping. -
How to count number of rows in table
can I get number of row in table except Count(*) in pl/sql
is there any other wayAlso posted and answered here
how to count number of rows in table
count(*) will be the fastest way. It is only slow if the table has a vast number of rows, in which case why do you need to know the tables has 73552436467721 rows and not 73552436467737 rows. It doesn't seem to be much use. Either that or you are counting them a lot, which again seems rather pointless. -
Hi!
1. How can you through ABAP and select statements count the number of rows in one table?
2. I want to read all rows from one table to an internal table. Can this be done dynamically or do I first have to count the number of rows in the table and then declare an internal table with the number of rows counted.
regards
BaranHI,
No you don't have to count number of rows first, Internal table size will increase dynamically. you have to declare this with initial size like this.
<b>data: itab type standard table of bkpf initial size 0.
SELECT * FROM bkpf into table itab.</b>
All values from bkpf will be inserted into table internal table itab.
Regards,
Maybe you are looking for
-
Budget Commitment on Parked Invoices
Dear Gurus, Can anyone guide me is there anyway i can get the Budget commitment on the parked FI documents like Invoices therough FV60 and FV50, in ECC 6 Public Sector Management. Regards
-
Camera Raw 6.4 - Downloads/Updates OK, Runs OK w/ PS CS5 Std
Lightroom 3.4 and Camera Raw 6.4 now available I never loaded the beta, so this is the first I've seen of this new update. The software downloaded and installed itself perfectly using Help - Updates... from within Photoshop CS5 standard, and seems to
-
Qosmio F10 Monitor in port wiring
Hi all, Anyone know the pin functions on the monitor in port on an F10. I can't find anyone who can sell me a lead so I need the pin functions to make up a lead for video and audio. Thanks Tony
-
Need info on field "userstatus" on ID tab of Employee view of the BP
On the business partner. Employee view on the Identification tab there is a field "username" Transaction BP Program (screen) SAPLBUS_LOCATOR Screen number 3000 Program (subscreen) SAPLBUD0_CP Screen numbe
-
How do I close the vertical bookmarks listing that is in my browsing window?
How do I close the vertical bookmarks listing that is in my browsing window?