Inserting Leading Zero's into Parameter
Within the database there are records that can be a total of 10 characters
For example the Packing List record within the database is 0000000257
I would like to create a parameter where the users only needs to enter in "257" and the report will find and return the information for the "0000000257" packing list.
Actually, that will NOT work! The formula given will cause a DB value of 1234567890 to match parameter value 890!
You need to do this instead (basic syntax):
formula = ({db field} = mid("0000000000", 1, 10 - length({?parameter})) + {?parameter})
HTH,
Carl
Similar Messages
-
How Do Everyone!
I have a currency amount say 144.66 and I want to insert leading zeroes.
I want to convert it to say 000000144.66
I have used the FM CONVERSION_EXIT_ALPHA_INPUT but because
there is a decimal point in the number it is not quite working.
Any ideas anyone??
Cheers
AndyHi,
Please try this.
DATA: P TYPE P DECIMALS 2 VALUE '144.66'.
DATA: N(12) TYPE C.
N = P.
SHIFT N RIGHT.
TRANSLATE N USING ' 0'.
WRITE:/ N.
Regards,
Ferry Lianto -
How to download leading zeros from internal table to XL file
Hi,
i am dowanloading data from interna table to XL file using GUI_DOWNLOAD FM. i want download the leading zeros also into xl file
EX: 012345
at present only "12345" is down loading into XL file. But i want "012345" into XL file.
Please help me.Hi,
Can you try with DBF format(Pass FILETYPE = 'DBF'? I remember that in this format data will be downloaded in database storage format. Just check and update if it works!!!
This is what FM documentation says.
'DBF' :
The data is downloaded in dBase format. With this format, the data types are stored as well, For this reason, import problems can be avoided - for example, problems with Microsoft Excel. In particular, you can avoid problems with the interpretation of numeric values.
Thanks,
Vinod. -
Need leading zeros to fill the front of a 10 character parameter being passed-HELP!
I have a prompt 10 character parameter that some people forget to insert the zero at the beginning of the number. ex.(they type "594468010", suppose to be "0594468010"). How can I fill in the leading zeros for them after they type in the prompt box? My prompt comes from a command. Here is a sample of the where clause: WHERE DB.ID_NUMBER = '{?I_IDNO}'
I tried to use LPAD('{?I_IDNO}',10,0), it works with plsql, but not when I run the crystal report.
Does anyone have any ideas? thanks for your help in advance!a) you can always use your database specific cast / convert function to convert the text field into a number for the purpose of record selection. then change the prompt type to numeric. crystal commands are database specific so you'd want to check your database help on what specific syntax to use for the cast / convert in the command.
b) the other choice to leave the command & prompt type alone & use an edit mask on the command prompt...this would then force the end user to enter the leading zeroes as the edit mask would force a certain length on the entry. so in the crystal field explorer edit the prompt and put in an edit mask of 000000000 for example if you wish to force the end user to enter 9 numeric characters. -
Truncation of leading Zeros when Down Loading into Excel - OLE Objects
Hi,
Can any one help me on this.
I am using <b>OLE Objects</b> to download Data into Excel Sheet. Data with leading Zeros is getting truncated in Excel.
Ex: Report Output is showing Plant Number as 0002. But when i am downloading to Excel Plant value will become 2 .
I would like to have it as 0002 in Excel.
I have declared Werks as CHAR of 4.I am using OLE Obects for Downloading into Excel Sheet.
I am using "OLE2_OBJECT" I can not use any other FMs to down load to Excel.As i am modifying this program not creating.
Thanks In Advance.
K.Nirmala
Message was edited by: Nirmala ReddyHi Nirmala,
While downloading to excel sheet, u need to change the number format of cell from General to Text, then leading zero's won't get deleted. For that u need to set the property of the cell. Please check this sample code,
INCLUDE OLE2INCL.
tables : zobrent.
data : it_kna1 type table of zobrent with header line.
handles for OLE objects
DATA: H_EXCEL TYPE OLE2_OBJECT, " Excel object
H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
DATA H TYPE I.
DATA: cell1 TYPE ole2_object.
*& Event START-OF-SELECTION
START-OF-SELECTION.
select * from zobrent into table it_kna1
where zopanid = '10001'
and zo_brent = '050'.
start Excel
CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
SET PROPERTY OF H_EXCEL 'Visible' = 1.
get list of workbooks, initially empty
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
PERFORM ERR_HDL.
add a new workbook
CALL METHOD OF H_MAPL 'Add' = H_MAP.
PERFORM ERR_HDL.
output column headings to active Excel sheet
PERFORM FILL_CELL USING 1 1 1 'EDate'.
PERFORM FILL_CELL USING 1 2 1 'Brent'.
PERFORM FILL_CELL USING 1 3 1 'Zopanid'.
PERFORM FILL_CELL USING 1 4 1 'Contract Type'.
PERFORM FILL_CELL USING 1 5 1 'Price Type'.
PERFORM FILL_CELL USING 1 6 1 'Installation Type'.
PERFORM FILL_CELL USING 1 7 1 'Volume'.
PERFORM FILL_CELL USING 1 8 1 'AQ'.
PERFORM FILL_CELL USING 1 9 1 '00000123'.
LOOP AT IT_KNA1.
copy values to active EXCEL sheet
H = SY-TABIX + 1.
PERFORM FILL_CELL USING H 1 0 IT_KNA1-zo_effdat.
PERFORM FILL_CELL USING H 2 0 IT_KNA1-zo_brent.
PERFORM FILL_CELL USING H 3 0 IT_KNA1-zopanid.
ENDLOOP.
CALL METHOD OF h_excel 'Cells' = cell1
EXPORTING
#1 = 1
#2 = 1.
FREE OBJECT H_EXCEL.
PERFORM ERR_HDL.
if sy-subrc eq 0.
write : / 'year'(001).
endif.
FORM FILL_CELL
sets cell at coordinates i,j to value val boldtype bold
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
PERFORM ERR_HDL.
GET PROPERTY OF H_ZL 'Font' = H_F.
PERFORM ERR_HDL.
SET PROPERTY OF H_F 'Bold' = BOLD .
PERFORM ERR_HDL.
***Changing the format of the cell from General to Text
<b>SET PROPERTY OF H_ZL 'NumberFormat' = '@'.</b>
PERFORM ERR_HDL.
SET PROPERTY OF H_ZL 'Value' = VAL .
PERFORM ERR_HDL.
ENDFORM.
*& Form ERR_HDL
FORM ERR_HDL.
IF SY-SUBRC <> 0.
WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
STOP.
ENDIF.
ENDFORM. " ERR_HDL
U just paste this code in a sample program & see.
Please reward, if found helpful. -
Adding leading zeros before data loaded into DSO
Hi
In below PROD_ID... In some ID leading zeros are missing before data loaded into BI from SRM into PROD_ID. Data type is character. If leading zeros are missing then data activation of DSO is failed due to missing zeros and have to manually add them in PSA table. I want to add leading zeros if they're missing before data loaded into DSO.... total character length is 40.. so e.g. if character is 1502 then there should be 36 zeros before it and if character is 265721 then there should be 34 zeros. Only two type of character is coming either length is 4 or 6 so there will be always need to 34 or 36 zeros in front of them if zeros are missing.
Can we use CONVERSION_EXIT_ALPHPA_INPUT functional module ? As this is char so I'm not sure how to use in that case.. Do need to convert it first integer?
Can someone please give me sample code? We're using BW 3.5 data flow to load data into DSO.... please give sample code and where need to write code either in rule type or in start routine...Hi,
Can you check at info object level, what kind of conversion routine it used by.
Use T code - RSD1, enter your info object and display it.
Even at data source level also you can see external/internal format what it maintained.
if your info object was using ALPHA conversion then it will have leading 0s automatically.
Can you check from source how its coming, check at RSA3.
if your receiving this issue for records only then you need to check those records.
Thanks -
Inserting Leads into a Text File?
Hello there, I am wondering if there is a way to insert leads
into a .txt file once a form is submitted?
If so how would this be achieved. I know you can do this with
PHP as I have done it before.
Thanks
Derek Bess> insert leads into a .txt file
There are plenty of file tags and functions available. But
what do you mean by "leads"?
http://livedocs.adobe.com/coldfusion/8/htmldocs/functions-pt0_20.html#1100017 -
Leading zeros when loading file into BPS
Hi all,
i'm trying to load a flat file into BPS cube via sap GUI according to the indication of the correspondent "How to paper".
As first column i have cost center (10 ch lenght). Usually in the File the leading zeros are not specified and in the paper it's specified to pay extra attention to those zeros.
So the question is:
HAVE i to include leading zeros in the file (for cost center)? Is it a mandatory task?
Thanks in advance.
FabioHi Anand,
Is it possible to load Excel or CSV file into BPS using the standard function module ?
If we use CSV format, then the leading zeros should be wiped out anyway.
I tried both format. None of them working. Is only TXT format allowed ?
Your help is much appreciated.
Regards,
Manish Jain -
API for insert Lead into telesales
How can Insert lead for customer using API in Telesales
Hi,
Currently, I believe there are no api's to populate the pa_transaction_control table.
If this is a new implementation and you are converting the projects from your legacy system for the first time, you should be able to directly insert date into these tables. This table does not have many FK relationships. Mainly depending on the transaction control is set at the Project or the Task level, you can set the values for Project id /Task id.
I would also suggest that you confirm with Oracle by creating a Tar that there is no API currently available.
- Vasu - -
How do I add leading zero(s) to exported files' names?
I'm using Lightroom 1.4 on an iMac, with OS X 10.4. When I export a batch of photos, they get numbered automatically. For example, if they're pictures of my dog, I'll specify "Dog" as the name to be used and 1 as the starting number. Lightroom will then export them as "Dog-1.tif" and "Dog-2.tif" and so on.
The problem is that when I then load these files into another application, it thinks that "Dog -1.tif" should be followed by "Dog-11.tif," then "Dog-12.tif," and so on to "Dog-19.tif" and then "Dog-2.tif," "Dog-20.tif," "Dog-21.tif," etc.
One solution to this would be to have them numbered as 01, 02, 03. . . 09, 10, 11, etc. Rather than add those leading zeros to the file names manually, I'd like to have Lightroom put them in when it exports the files, but I can't figure out how to do that. I've tried entering 01 as the starting number in the "Export" dialogue box, but that doesn't do the trick.
Can anybody tell me how to get Lightroom to add a leading zero (or zeros, when I export more than 99 files at a time) to the file names?>What if I just wanted to name the images 0001, 0002, 0003, etc? Can't seem to figure that out.
In the Filename Template Editor, simply insert the [Sequence # (0001)] token as the only entry in the template field. -
XmltoQuery removing leading zero
Hi,
I have a function that takes in a raw xml and covert to query. The problem is any leading zeroes are gone. For example, 000123 will become 123. Is there any way or function in CF that will stop from removing leading zeroes?
Thanks,Oh, sorry. It's not the XML to Query problem but it's the cfquery problem. When I cfdump the data, it shows 000123, but when I use <cfquery> to insert the data into a dabase, it strips the leading zeroes and in the db table it shows only 123. Is there a function or something to prevent this?
<cfoutput query="get_xml_data">
<cfquery name="test" datasource="db">
INSERT INTO table (id, name)
VALUES (#get_xml_data.id#, #get_xml_data.name#)
</cfquery>
</cfoutput> -
Hi i have a table having structure as
CREATE TABLE "OMPODI"."END_RECORD"
"RECORD_TYPE" CHAR(5 BYTE),
*"TOTAL_NUMBER" CHAR(10 BYTE)*
and insert statement is as
insert into ompodi.end_record
(select 'END',to_char(count(*)+2) from omp.ompproduction where locationid='MES2'
and (select distinct to_char(to_date(productionweek,'YYYYMMDD'),'ww') from omp.ompproduction)>=(SELECT TO_CHAR(sysdate,'WW') FROM DUAL))
I want to have leading zeros for total_number.
e.g:- i i have a count of 10 then it should be displayed as '000000010'.
How it can be achieved?
Edited by: MaheshGx on Feb 5, 2012 10:29 AM
Edited by: MaheshGx on Feb 5, 2012 10:29 AM
Edited by: MaheshGx on Feb 5, 2012 10:30 AMMaheshGx wrote:
Hi i have a table having structure as
CREATE TABLE "OMPODI"."END_RECORD"
"RECORD_TYPE" CHAR(5 BYTE),
*"TOTAL_NUMBER" CHAR(10 BYTE)*
and insert statement is as
insert into ompodi.end_record
(select 'END',to_char(count(*)+2) from omp.ompproduction where locationid='MES2'
and (select distinct to_char(to_date(productionweek,'YYYYMMDD'),'ww') from omp.ompproduction)>=(SELECT TO_CHAR(sysdate,'WW') FROM DUAL))
I want to have leading zeros for total_number.
e.g:- i i have a count of 10 then it should be displayed as '000000010'.
How it can be achieved?
Edited by: MaheshGx on Feb 5, 2012 10:29 AM
Edited by: MaheshGx on Feb 5, 2012 10:29 AM
Edited by: MaheshGx on Feb 5, 2012 10:30 AM
1* select to_char(10,'0000000009') from dual
SQL> /
TO_CHAR(10,
0000000010 -
I am extracting data from a text file and putting it in an SQL Server 2000 database. When I insert fields with leading zeros into the database, the zeros are trimmed away. All my data are string type and I use VARCHAR in the database for those fields.
When I insert literal strings with leading zeros, the zeros do appear in the database.
Any help is much appreciated.
AkzThis is the code I use to update my SQL Server database. As you can see, 5 strings are declared and initialized; some have leading zeros.
4451972 129293 040504 015011 000319
When I open the databse , the leading zeros are missing.
The database record for the record I just inserted looks like the following:
4451972 129293 40504 15011 319
What happens to the leading zeros?
This is the code:
String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=CRD_DB";
Connection con;
Statement stmt;
String caller="4451972", called="129293", date="040514", startTime="015011",
duration="000319";
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try{
con = DriverManager.getConnection(url,"pola", "pola" );
stmt = con.createStatement();
stmt.executeUpdate("INSERT INTO CRDTableNew values("+caller +"," + called+","+date
+","+startTime+","+duration+")");
stmt.close();
con.close();
catch(SQLException ex){
System.err.println("SQLExc.:" + ex.getMessage());
} -
XLR and Items with leading zeros
Forum,
Does anyone know the best way, in XL Reporter, to deal with Item Codes that have leading zeros?
Scenario:
We have 2 items: 001, and 0001
When I pull these into XLR and generate the report, Excel converts the numbers to "1"
I have tried every cell format I can think of and have not come up with a solution.
"Text" type returns the XLR syntax (=ixDimGet("ITM", "ItemCode")), "General" returns the "1" without leading zeros, etc.
Anyone have a solution?
Thanks in Advance,
Brad WindeckerHi Brad,
Seems like there's not direct solution for this one, function ixDimGet automatically removes leading zeros.
Anyway, I would suggest that we utilize Macro Programming for this one.
Here is a short macro code I developed, assuming the item Code is placed in Column B and the macro will automatically extract the parameter from the function call in Column B (=ixDimGet("00002") and place it Column C.
Just place the ff code in SHEET1. The macro is utilizing the Worksheet Change event
Const colItemCode = 2
Const colShowCode = 3
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = colItemCode Then
strFormula = Target.Formula
If Left(strFormula, 9) = "=ixDimGet" Then
itemCode = Mid(strFormula, 12, Len(strFormula) - 13)
With Range(Chr(64 + colShowCode) & Target.Row)
.NumberFormat = "@"
.Value = itemCode
End With
End If
End If
End Sub
Constant colItemCode is referring to the column of the Item Code
Constant colShowCode is referring to the column for the exracted Item Code
Hope this help
Laurence Resubal -
Exporting Numbers file with leading zeros as csv file
When I export a list of mobile phone numbers with leading zeros (086* etc.) from Numbers as a csv file, the leading zeros are stripped out, although the cells are previously formatted as text. What can I do about this?
"When I export a list of mobile phone numbers with leading zeros (086* etc.) from Numbers as a csv file, the leading zeros are stripped out, although the cells are previously formatted as text. What can I do about this?"
Well, the first thing you could do would be to post your question in one of the forums for Numbers.
Click Discussions to get to the Discussions index page, then the section for the version of iWork you're using, then the Numbers forum in that section.
In AppleWorks (which doesn't offer an opportunity to Save as or Export as csv) I'd force the application to see the phone numbers as text by inserting some non-numeric characters into the string of digits.
Examples: 000-123-4567, 000 123 4567
It may also be a function of the application you are using to open the csv file.
When I did a brief test of the suggestion above with Numbers '09, I got this result on opening the file in Text Edit:
,1234567890,num
,123-456-7890,tex
,0123456789,num
,012-345-6789,tex
,0001234567,num
,000-123-4567,tex
Note that both the examples entered as a string of digits only (num) and those entered with inserted hyphens (tex) kept the leading zeroes. Cell format for the column containing the phone numbers was set to Text.
Regards,
Barry
Maybe you are looking for
-
Assigning AnyConnect Client Profiles based on the machine?
I have an ASA running 8.2.x code with AnyConnect 2.4.x.I have both Radius and LDAP (AD) AAA available. If a user connects from a company owned laptop, I want to push down AnyConnect client ProfileA (with scripts to map drives etc...) and network ACL'
-
Prevent errors when previewing app including Vibration ANE on desktop
I am making use of Adobe's Vibration ANE. It works fine when I deploy on my device but throws an error when I test my movie in the Flash IDE. The content cannot be loaded because there was a problem loading an extension: Error: Requested extension co
-
I need to know how to get my printer to send copies to the computer
can't get printer to send info orcopies to computer for or to send email
-
The attempt to burn a disc failed. The disc could not be read from or written to.
I am trying to burn a cd after upgrading to itunes 12 and this message keeps coming up."The attempt to burn a disc failed. The disc could not be read from or written to." there is no problem with my hardware since I can burn cds using nero. Please he
-
Help pllease everytime i have updated my iphone 5, everything disappears. I had an old phone the iphone 4 which had the same problem i had my iphone 5 for 4 months now.