How to suppress some lines from printing
Dear all
I have a problem of suppressing some lines in a character mode report depending on some condition. E.g. say I have 5 lines per record to be printed. Say Name, Add1, Add2, Add3, City. Now depending on a condition, I don't want to print Add2, instead Add3 and City should move upward one line resulting only 4 lines in the report. Like wise there may be only two lines in the report, Name and City only.
How to accomplish this task? Thanks in advance.
Easy in to do it in the query:
select rtrim(decode(adr1,null,null,adr1||chr(10))||
decode(adr2,null,null,adr2||chr(10))||
decode(city,null,null,city||chr(10))||
country,
chr(10))
from address
Similar Messages
-
How to read some lines from a text file using java.
hi,
i m new to java and i want to read some lines from a text file based on some string occurrence in the file. This file to be read in steps.
we only want to read the file upto the first Occurrence of "TEXT" string.
How to do it ,,,
Kinldy give the code
Regards,
Sagar
this is the text file
dfgjdjj
sfjhjkd
ghjkdg
hjkdgh TEXT
ikeyt
ujt
jk
tyk TEXT
rukl
rHendawy wrote:
Since the word "TEXT" is formed of 4 letters, you would read the text file 4 bytes by four bytes. Wrong on two counts. First, the file may not be encoded 1 byte per character. It could be utf-16 in which case it would be two byte per character. Second, even if it were 1 byte per character, the string "Text" may not start on a 4 byte boundary.
Consider a FileInputStream object "fis" that points to your text file. use fis.read(byte[] array, int offset, int len) to read every four bytes. Convert the "TEXT" String into a byte array "TEXT".getBytes(), and yous the Arrays class to compare the equality of the read bytes with your "TEXT".getBytes()Wrong since it relies on my second point and will fail when fis.read(byte[] array, int offset, int len) does not read 4 bytes (as is no guaranteed to). Check the Javadoc. Also, the file may not be encoded with the default character encoding.
The problem is easily solved by reading a line at a time using a BufferedReader wrapping an InputStreamReader wrapping a FileInputStream and specifying the correct character encoding.
Edited by: sabre150 on Apr 29, 2009 2:13 PM -
J4680 printing bottom half of some lines of print. What can be done?
HPJ4680 is printing only the bottom half of some lines. Can I correct this?
Hi @ReneePM,
Welcome to the HP Forums!
I noticed that your HP J4680 is printing bottom half of some lines of print. I am happy to help you with this printing issue!
For further assistance, I will need to know the following:
If you are using a Windows or Mac Operating System, and the version number. To find the exact version, visit this link. Whatsmyos.
If the printer is able to make copies.
If the power cable is plugged into a surge protector, or directly to the wall outlet. Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector. This applies to Inkjet printers as well.
Please see this post, Want Good Answers? Ask Good Questions, by @Bob_Headrick, so you can get the most out of these forums.
If you are using Windows please try the HP Print and Scan Doctor, and let me know what happens!
Thank you for posting, and hope to hear from you soon!
RnRMusicMan
I work on behalf of HP
Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos Thumbs Up" to say “Thanks” for helping! -
In alv report , how to reserve 20 lines from beginning of page
hi experts
in alv report , how to reserve 20 lines from beginning of page.
regards
subhasis.If by reserve you mean should not move on scrolling then make them KEY from fieldcatalog.
But I think maximum of 10-12 can be handled by that.
Regards,
Amit
Reward all helpful replies. -
How to export some data from the tables of an owner with integrity?
Hi to all,
How to export some data from the tables of an owner with integrity?
I want to bring some data from all tables in a single owner of the production database for development environment.
My initial requirements are: seeking information on company code (emp), contract status (status) and / or effective date of contract settlement (dt_liq_efetiva) - a small amount of data to developers.
These three fields are present in the main system table (the table of contracts). Then I thought about ...
- create a temporary table from the query results table to contract;
- and then use this temporary table as a reference to fetch the data in other tables of the owner while maintaining integrity. But how? I have not found the answer, because: what to do when not there is the possibility of a join between the contract and any other table?
I am considering the possibility of consulting the names of tables, foreign keys and columns above, and create dynamic SQL. Conceptually, something like:
select r.constraint_name "FK name",
r.table_name "FK table",
r.column_name "FK column",
up.constraint_name "Referencing name",
up.table_name "Referencing table",
up.column_name "Referencing column"
from all_cons_columns up
join all_cons_columns r
using (owner, position), (select r.owner,
r.constraint_name fk,
r.table_name table_fk,
r.r_constraint_name r,
up.table_name table_r
from all_constraints up, all_constraints r
where r.r_owner = up.owner
and r.r_constraint_name = up.constraint_name
and up.constraint_type in ('P', 'U')
and r.constraint_type = 'R'
and r.owner = 'OWNERNAME') aux
where r.constraint_name = aux.fk
and r.table_name = aux.table_fk
and up.constraint_name = aux.r
and up.table_name = aux.table_r;
-- + Dynamic SQL
If anyone has any suggestions and / or reuse code to me thank you very much!
After resolving this standoff intend to mount the inserts in utl_file by a table and create another program to read and play in the development environment.
Thinking...
Let's Share!
My thanks in advance,
PhilipsThanks, Peter.
Well, I am working with release 9.2.0.8.0. But the planning is migrate to 10g this year. So my questions are:
With Data Pump can export data just from tables owned for me (SCHEMAS = MYOWNER) parameterizing the volume of data (SAMPLE) and filters to table (QUERY), right? But parameterizing a contract table QUERY = "WHERE status NOT IN (2,6) ORDER BY contract ":
1º- the Data Pump automatically searches for related data in other tables in the owner? ex. parcel table has X records related (fk) with Y contracts not in (2,6): X * SAMPLE records will be randomly exported?
2º- for the tables without relation (fk) and which are within the owner (MYOWNER) the data is exported only based on the parameter SAMPLE?
Once again, thank you,
Philips
Reading Oracle Docs... -
How to read some images from file system with webdynpro for abap?
Hi,experts,
I want to finish webdynpro for abap program to read some photos from file system. I may make MIMES in the webdynpro component and create photos in the MIMES, but my boss doesn't agree with me using this way. He wish me read these photos from file system.
How to read some images from file system with webdynpro for abap?
Thanks a lot!Hello Tao,
The parameter
icm/HTTP/file_access_<xx>
may help you to access the pictures without any db-access.
The following two links may help you to understand the other possibilities as well.
The threads are covering BSP, but it should be useful for WebDynpro as well.
/people/mark.finnern/blog/2003/09/23/bsp-programming-handling-of-non-html-documents
http://help.sap.com/saphelp_sm40/helpdata/de/c4/87153a1a5b4c2de10000000a114084/content.htm
Best regards
Christian -
How do I keep URLs from printing after Events?
Version 3.0.8 (1287) - How do I keep URLs from printing after Events?
Open the Pages preferences > uncheck Automatic detect email and web addresses
-
How to exclude some tables from schema level replicatio????
Hi,
I am working on oracle10g stream replication.
My replication type is "Schema Based".
So can anyone assist me to undersatnd, how to exclude some tables from schema based replication.
Thanks,
FaziarainYou can use rules and include them in the rule set, lets say you dont want LCR to be queued for table_1 in schema SALES, write two rules one for DDL and another for DML with NOT logical condition.
DBMS_RULE_ADM.CREATE_RULE(
rule_name => 'admin.SALES_not_TALBE_1_dml', condition => ' (:dml.get_object_owner() = ''SALES'' AND NOT ' ||
' :dml.get_object_name() = ''REGIONS'') AND ' ||
' :dml.is_null_tag() = ''Y'' ');
DBMS_RULE_ADM.CREATE_RULE(
rule_name => 'admin.hr_not_regions_dlll',
condition => ' (:dml.get_object_owner() = ''SALES'' AND NOT ' ||
' :ddl.get_object_name() = ''table_!'') AND ' ||
' :dsl.is_null_tag() = ''Y'' ');
just go through this document once, http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/strms_rules.htm#i1017376
Edited by: user8710159 on Sep 16, 2009 5:21 PM -
Goto: How to export some data from the tables of an owner with integrity?
Hi to all,
Help please: How to export some data from the tables of an owner with integrity?
My thanks in advance,
PhilipsThanks, Peter.
Well, I am working with release 9.2.0.8.0. But the planning is migrate to 10g this year. So my questions are:
With Data Pump can export data just from tables owned for me (SCHEMAS = MYOWNER) parameterizing the volume of data (SAMPLE) and filters to table (QUERY), right? But parameterizing a contract table QUERY = "WHERE status NOT IN (2,6) ORDER BY contract ":
1º- the Data Pump automatically searches for related data in other tables in the owner? ex. parcel table has X records related (fk) with Y contracts not in (2,6): X * SAMPLE records will be randomly exported?
2º- for the tables without relation (fk) and which are within the owner (MYOWNER) the data is exported only based on the parameter SAMPLE?
Once again, thank you,
Philips
Reading Oracle Docs... -
How to stop Officejet 6210xi from printing logs
We inherited an officejet 6210xi. (No manual.) It is being used standalone as a fax. It now prints a log for each and every fax. This is a huge waste of paper, so how do we stop it from printing a log every time? Thanks.
Hi,
May be it is the alignment page. Please perform aligning the printer once as per the steps below and check if helps.
Follow these steps to open the printer toolbox and align the printer, if you found defects on the print quality diagnostic report.
1. Load plain white paper in the input tray.
2. Open HP Solution Center:
3. Click Settings.
4. Under Print Settings , click Printer Toolbox . The printer Toolbox opens in a new window.
5. Click the Device Services tab.
6. Click Align the Printheads .
The product aligns the printheads. When the alignment is complete, the product prints an alignment page.
After the successful alignment, restart the printer and check.
I work for HP but my posts and replies are my own.
Say Thanks by clicking the Kudos Star in the post that helped you.
Please mark the post that solves your problem as Accepted Solution -
How to remove characters/lines from the beginning of an InputStream
Hi,
I have a program which receives several InputStreams. From each of these streams I have to remove 2 lines from the beginning. After the lines are removed, all the streams are combined to one with SequenceInputStream and read in one chunk. Is there an easy/simple way of doing this?
One option I thought would be to read the char by char until 2 end of line chars have been detected and then read the rest of the data to a buffer. And the create a ByteArrayInputStream out of this buffer. Problem with this approach is, that the amount of data can be large, so putting all the data in to memory might cause problems.
Another option is to use BufferredInputStream and use the readline() method twice to get rid of the lines that are not needed. After this I would write the data to some output stream, which is then converted back to input stream. Propably would work, but sound too much of work for a simple thing like this. There has to be better way.
To make it simple, what I need is a method that looks like the following, or something similar
* Removes n number of lines from the beginning of a InputStream.
* @param is InputStream where the lines are removed
* @param numberOfLines int value to indicate how many lines whould be removed
* @return InputStream where lines have been removed.
public InputStream removeLines(InputStream is, numberOfLines);Thanks.Here's the code, feel free to use it. Comments are also welcome.
public InputStream removeLinesFromTheBeginning(InputStream is, int numberOfLines) throws IOException
char c = 'c';
int i = 0;
for(int n = 0 ; n < numberOfLines ; n++)
do
c = (char)is.read();
System.out.print(c);
if(c == (char)-1) // end of stream reached before any newline characters were found.
return null;
i++;
while(c != '\n');
System.out.println();
System.out.println("Characters removed:" + i);
System.out.println("n: " + n);
i = 0;
return is;
}Edited by: dave_spaghetti on Jun 16, 2009 5:42 AM
Fixed a bug. -
Any hints of how to exclude these lines from the following BEx output?
Hi,
I have a BEx report which outputs the following shipment activities, showing Doc and Items numbers, Requested and Received dates, actual and PO quantities.
DocNoItmNoReqDate-RcvdDate-PO_Qty-Act_Qty---TB%
1101-----5--12/10/05-12/5/05020--
80
1101-----5--12/10/05#00--80
1101-----5--12/10/05#200--
80
1101-----7--12/10/05-12/5/05030--
50
1101-----7--12/10/05-12/8/0505--
50
1101-----7--12/10/05#00--50
1101-----7--12/10/05#350--
50
Somehow, I am getting some activity lines which I do not understand but do not want in the output. Those are the lines which show u201CPO_Qty = 0 AND Act_Qty = 0 at the same time.u201D i.e. the highlighted lines.
Any hint on how to eliminate the highlighted lines from the output?
I played with calculated key figures but could not reason it out.
ThanksDocNoItmNoReqDate-RcvdDate-PO_Qty-Act_Qty--- Formula TB%
PO QTY + ACT QTY
1101-----5--12/10/05-12/5/05020----- 20 -
80
1101-----5--12/10/05#00-- 0 -80
1101-----5--12/10/05#200----- 20 -
80
1101-----7--12/10/05-12/5/05030----- 30 -
50
1101-----7--12/10/05-12/8/0505--
5 -
50
1101-----7--12/10/05#00----- 0 -50
1101-----7--12/10/05#350----- 35 -
50
Create Conditions over the Formula. Since the sum would be always 0 only when both the KF's are zero I think you can create condition over this formula.
Would this help?
Regards
VJ -
How to suppress blank lines in smartforms
Hi all,
How can we suppress blank lines in smartforms?
In my scenario I am having customer address details in main window.
i.e. Name
Street
P O Box
P O Box Location
Post Code
Telephone
Fax.
Suppose if there is no value for P O Box Location the address is getting displayed as
Name
Street
P O Box
-> Leaving blank space
Post Code
Telephone
Fax.
But I want it as
Name
Street
P O Box
Post Code
Telephone
Fax.
i.e The blank line should not be displayed.
Kindly let me know how to do this.
Regards,
Neethupriya.Hi Neethu,
Are you using ADDRESS option in smartforms or code to get address from customer master?
If you are using code, you can give condition like P O Box Location <> SPACE in condition tab.
Pranav -
How to read every line from a text file???
How can i read every line from my text file ("eka.txt")
now it only reads the first line and prints it out.
What is wrong with this?
import java.io.*;
import java.util.*;
class Testi{
public static void main(String []args)throws IOException {
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
File inputFile = new File ("eka.txt");
FileReader fis =new FileReader(inputFile);
BufferedReader bis = new BufferedReader(fis);
String test=bis.readLine();
String tmp= "";
while((bis.readLine().trim() != null)) {
int spacefound=0;
int l=test.indexOf(" ");
for(int i=0;i<test.length();i++){
char c=test.charAt(i);
if(c!=' ') tmp+=""+c;
if(c==' ' && (spacefound<1) && !(tmp.equals(""))){
tmp+=""+c;
spacefound++;
if(tmp.length()==l) {
System.out.println(tmp);
tmp="";
spacefound=0;
if(tmp.length()<l){
for(int i=0;i<=(l-tmp.length());i++)
tmp+=""+' ';
System.out.println(tmp);Try this code, Hope it servers your purpose.
import java.io.*;
import java.util.*;
class Testi {
public static void main(String []args)throws IOException {
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
File inputFile = new File ("Eka.txt");
FileReader fis =new FileReader(inputFile);
BufferedReader bis = new BufferedReader(fis);
String test=bis.readLine();
while(test != null) {
StringTokenizer st = new StringTokenizer(test," ");
while(st.hasMoreTokens())
System.out.println(st.nextToken());
test = bis.readLine();
}Sudha -
How to remove empty lines from xml files after removing nodes from document
<pre>
Hi
<b>i have xml document, which is shown below
after removing some nodes from the document ,i am getting empty lines in place of removed nodes,how to resolve this and get the proper xml document without any errors</b>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE Message SYSTEM "TRD01.dtd">
<Message>
<Header>
<CounterPartyType>CLIENT</CounterPartyType>
<CreationTime>20134455</CreationTime>
<ErrorCode>363 </ErrorCode>
<ErrorEnterPriseId>N</ErrorEnterPriseId>
<ErrorStatus>1</ErrorStatus>
<ErrorSystemId>STL</ErrorSystemId>
<ErrorTimes>31</ErrorTimes>
<MessageType>T</MessageType>
<RecipientEnterpriseId>N</RecipientEnterpriseId>
<RecipentSystemId>EXM</RecipentSystemId>
<Remarks>REMARSK</Remarks>
<SenderEnterpriseId>N</SenderEnterpriseId>
<SenderSystemId>TR</SenderSystemId>
</Header>
</Message>
<ErrorCode>363 </ErrorCode>
<ErrorEnterPriseId>NIHK</ErrorEnterPriseId>
<ErrorStatus>1</ErrorStatus>
<ErrorSystemId>STL</ErrorSystemId>
<ErrorTimes>31</ErrorTimes>
XPathExpression expression5 = xpath.compile(xmlpath5);
Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
Node node5 = (Node) result5;
node5.getParentNode().removeChild(node5);
XPathExpression expression6 = xpath.compile(xmlpath6);
Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
Node node6=(Node) result6;
node6.getParentNode().removeChild(node6);
XPathExpression expression7 = xpath.compile(xmlpath7);
Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
Node node7=(Node) result7;
node7.getParentNode().removeChild(node7);
doc.normalize();
doc.normalizeDocument();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
t.setOutputProperty(OutputKeys.METHOD,"xml");
t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
the xml output i am getting is
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Message>
<Header>
<CounterPartyType>CLIENT</CounterPartyType>
<CreationTime>20134455</CreationTime>
<MessageType>TRD01</MessageType>
<RecipientEnterpriseId>N</RecipientEnterpriseId>
<RecipentSystemId>STL</RecipentSystemId>
<Remarks>REMARSK</Remarks>
<SenderEnterpriseId>N</SenderEnterpriseId>
<SenderSystemId>T</SenderSystemId>
</Header>
</Message>
<b>could you please let me know how to avoid empty lines in the xml doucment output</b>
this is the method i am using to get the result
public void ValidateRecord(String xml){
try{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
//parse file into DOM
/*DOMParser parser = new DOMParser();
parser.setErrorStream(System.err);
parser.setValidationMode(DTD_validation);
parser.showWarnings(true);*/
System.out.println ("HI THIS xml is validation "+xml);
Resolver res = new Resolver();
db.setEntityResolver(res);
Document doc = db.parse(new InputSource(new StringReader(xml)));
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
// XPathExpression expression = xpath.compile("//A/B[C/E/text()=13]");
String xmlpath="/Message/Header/CounterPartyType/text()";
String xmlpath1="/Message/Header/RecipentSystemId/text()";
String xmlpath2="/Message/Header/ErrorSystemId/text()";
XPathExpression expression = xpath.compile(xmlpath);
XPathExpression expression1 = xpath.compile(xmlpath2);
Object result = expression.evaluate(doc, XPathConstants.NODE);
Object result1 = expression1.evaluate(doc, XPathConstants.NODE);
Node node = (Node) result;
Node node1 = (Node) result1;
System.out.println("the values of the string is " +node.getNodeValue());
System.out.println("the values of the string is " +node1.getNodeValue());
// for (int i = 0; i < nodes.getLength(); i++) {
//System.out.println(nodes.item(i).getNodeValue());
// CAHNGING THE RECEIPENT NODE
XPathExpression expression2 = xpath.compile(xmlpath1);
Object result2 = expression2.evaluate(doc, XPathConstants.NODE);
Node node2 = (Node) result2;
System.out.println(node2);
node2.setNodeValue(node1.getNodeValue());
System.out.println(node2);
//removing the nodes from document
String xmlpath3="/Message/Header/ErrorCode";
String xmlpath4="/Message/Header/ErrorEnterPriseId";
String xmlpath5="/Message/Header/ErrorStatus";
String xmlpath6="/Message/Header/ErrorSystemId";
String xmlpath7="/Message/Header/ErrorTimes";
XPathExpression expression3 = xpath.compile(xmlpath3);
Object result3 = expression3.evaluate(doc, XPathConstants.NODE);
Node node3 = (Node) result3;
node3.getParentNode().removeChild(node3);
XPathExpression expression4 = xpath.compile(xmlpath4);
Object result4 = expression4.evaluate(doc, XPathConstants.NODE);
Node node4 = (Node) result4;
System.out.println("node value");
System.out.println(node4.getParentNode().getNodeName());
node4.getParentNode().removeChild(node4);
XPathExpression expression5 = xpath.compile(xmlpath5);
Object result5 = expression5.evaluate(doc, XPathConstants.NODE);
Node node5 = (Node) result5;
node5.getParentNode().removeChild(node5);
XPathExpression expression6 = xpath.compile(xmlpath6);
Object result6 = expression6.evaluate(doc, XPathConstants.NODE);
Node node6=(Node) result6;
node6.getParentNode().removeChild(node6);
XPathExpression expression7 = xpath.compile(xmlpath7);
Object result7 = expression7.evaluate(doc, XPathConstants.NODE);
Node node7=(Node) result7;
node7.getParentNode().removeChild(node7);
// Node b13Node = (Node) expression.evaluate(doc, XPathConstants.NODE);
//b13Node.getParentNode().removeChild(b13Node);
doc.normalize();
doc.normalizeDocument();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.setOutputProperty(OutputKeys.INDENT, "yes");
t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
t.setOutputProperty(OutputKeys.METHOD,"xml");
t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
t.transform(new DOMSource(doc), new StreamResult(System.out));
catch (Exception e) {
e.printStackTrace();
System.out.println(e.getMessage());
</pre>
Edited by: user12185243 on Apr 6, 2013 6:38 AM
Edited by: user12185243 on Apr 6, 2013 6:41 AM
Edited by: user12185243 on Apr 6, 2013 6:43 AM
Edited by: user12185243 on Apr 6, 2013 6:45 AM
Edited by: user12185243 on Apr 6, 2013 9:00 AMeither this way we can do this
1)
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
<b> factory.setIgnoringElementContentWhitespace(true); </b>
DocumentBuilder db = factory.newDocumentBuilder();
or
2)
java.io.StringWriter sw = new java.io.StringWriter();
StreamResult sr = new StreamResult(sw);
t.transform(new DOMSource(doc), sr);
String xml1 = sw.toString().trim();
<b> xml1=xml1.replaceAll("\\s",""); </b>
System.out.println(xml1.trim());
Maybe you are looking for
-
IN ALV Report 'SAVE LAYOUT' option missing
Dear All, I have created one report in ALV GRID using ABAP OBJECTS(Using class CL_GUI_CUSTOM_CONTAINER and CL_GUI_ALV_GRID).But in output when i click on change layout option i am not getting SAVE layout option. I have already passed I_S
-
I recently downloaded Supernatural season seven, and cannot download it onto my 4th generation iPod touch, and cannot find any other way to watch it. I have iTunes on Window XP, but not a Mac or PC. The show will come up, but not completely load. Any
-
How to install Windows 7 Pro 64bit from a Retail DVD
Good afternoon I have got a Lenovo X201 which unfortunately cannot locate a recovery disc I mtherefore purchased a retail version of Win7 Pro 64 bit and put into my external DVD player to install I changed the boot option to look at the wxternal dvd
-
Just got a I Phone 4. I typed my wifi password to connect to my wifi but don't see a "connect" button or "enter". I tried "join" but it did nothing? How do I connect to my wi-fi so I don't use cell minutes when at home? Also, How do I know for sure
-
Hi, I have created a User Access report for CRM on-premise using SQl query in the following format. One row corresponds to one user in organization. Currently, I am using Microsoft Dynamics CRM Online trial version and have two users in my organizati