Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Java Basics
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 4th, 2012, 12:34 AM
Registered User
 
Join Date: Feb 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help With Enumeration: How to parse and send to a database

Good Evening,

I am in the midst of a project and have come across two delima's. Currently have a project in which I have to enumerate thru an external source. I have everything written to download to a file but now need to find a way to do two things for which I am at a loss. First one is to parse results from the enumeration to only include part of the result string and second is to send the results to a database. I have the database connection aspect figured out just now how to get the results to go to it.

AccountName field value is formatted like number "Space" name and I just need to get the number value and remove the name. Database is a SQL Database. Any help would be so appreciative.

Excerpt of the code with the enumeration.

Code:
@SuppressWarnings("rawtypes")
Enumeration enumReportFields = generalQuery.getAvailableReportFields();
            
ReportFieldSet fieldSet = generalQuery.getReportFieldSet();
while(enumReportFields.hasMoreElements()) {
            	
ReportField reportField = (ReportField) enumReportFields.nextElement();
  if(reportField.getFieldName().equals("AccountName"))
  fieldSet.addField(reportField);
  }
            
  ReportMetricSet reportMetricSet = generalQuery.getReportMetricSet();
  @SuppressWarnings("rawtypes")
 Enumeration enumReportMetrics = generalQuery.getAvailableReportMetrics();
            while(enumReportMetrics.hasMoreElements()) {
ReportMetric reportMetric = ((ReportMetric)enumReportMetrics.nextElement());
                if(reportMetric.getMetricName().equals("Value1")
                		|| reportMetric.getMetricName().equals("value2"))
                    reportMetricSet.addMetric(reportMetric);
                
            }
As of this moment the results are going to a file via an inputstream/fileoutputstream.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Enumeration nguyendh BOOK: Ivor Horton's Beginning Visual C++ 2005 3 June 25th, 2006 01:22 AM
How to Use Enumeration in VB6 ramk_1978 VB How-To 1 December 6th, 2004 02:35 PM
AD Group enumeration raspar VB How-To 1 June 15th, 2004 02:18 PM
Enumeration tbriers VB How-To 0 March 30th, 2004 04:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.