Unable to pull data from 2 tables of a database linked to a 2nd database

I have a Crystal V7 Report I'm upgrading to Crystal 10 or 11.  It uses the following formula that works (data is in ONE MS Access database containing all three tables):
If {PayrollCalc.qSource}=0  then {AuthorizedWithholding.qDesc
else If {PayrollCalc.qSource}=1 or {PayrollCalc.qSource}= 2 then {UnionBenefitDetail.qUBDesc}
else
If {PayrollCalc.qSource}=4 then "Extra Tax" + {PayrollCalc.qID} else
If {PayrollCalc.qSource}=5 then "Payroll Insurance" else
If {PayrollCalc.qSource}=6 then {PayrollCalc.qID} else
Mid ({PayrollCalc.qID},2 )
The upgraded application software uses TWO SQL 2005 Express databases, replacing the one Access database.  PayrollCalc is a table in database A while UnionBenefitDetail & AuthorizedWithholding are tables in database B.  The links are left outer joined from PayrollCalc table to each of the others (I've tried all the enforcement options) but the formula no longer works.  If I remark out the part of the formula from one or the other of the "extra" tables, then the one still active works great but I can't get both to work in the same subreport.  There's no error, I just get a blank returned for the formula.  I'm not familiar with using the Add Command so I haven't tried that.  Can anyone help me?

I confirmed that the join fields are identical:
PRCalc Table - qConNo=int (32 bit), length 4
PRCalc Table - qID=varchar (byte), length 10
PRCalc Table - qSeg=int (32 bit), length 4
UnionBenefit Table - qUBID=varchar (byte), length 10
UnionBenefit Table - qUBSeg=int (32 bit), length 4
Both of these UnionBenefit fields are left outer joined FROM the PRCalc Table's qID & qSeg fields
Authorized Withholding - qConNo=int (32 bit), length 4
Authorized Withholding - qSeg=int (32 bit), length 4
These two fields are left outer joined FROM PRCalc's qConNo & qSeg fields.
The qDesc & qUBDesc fields that I'm trying to print in the same subreport using the formula that's not working are both varchar (bye), length 50 fields.
I have tried various other joins unsuccessfully.  I'm convinced that the left outer join is the correct one to use since neither of the tables from Database B will always have records that match up with those in Database A (PayrollCalc's database).  So yes, it appears that the left outer join does not work properly across two databases when more than one table in the 2nd database is used.  It works fine if I just use one table from database B & do a separate subreport for the other table.

Similar Messages

  • I need to copy data from a table in one database (db1) to another table in

    Hi
    I need to copy data from a table in one database (db1) to another table in another database (db2).
    I am not sure if the table exists in db2,,,if it doesnot it needs to be created as well data also needs to be inserted...
    How am I supposed to this using sql statements..?
    I shall be happy if it is explained SQL also...
    Thanking in advance

    How many rows does the table contains? There are manyway you can achieve this.
    1. export and import.
    2. create a dblink between two databases and use create table as select, if structure doesnot exists in other database, if structure exists, use, insert into table select command.
    example:
    create a dblink in db2 database for db1 database.
    create table table1 as select * from table1@db1 -- when there is no structure present
    -- you need to add constraints manually, if any exists.
    insert into table1 select * from table1@db1 -- when there is structure present.
    If the table contains large volume of data, I would suggest you to use export and import.
    Jaffar

  • Pull data from a table in HTML format from external URL into a Servlet

    How do I pull data from existing website html table into a Servlet?
    I will need to pull the data into a servlet. So, the servelet will need to go to the URL and get the data and save them as variables.
    I know I will need an array to store the data. I just dont know how to call the URL and have the servelet search the site for the <table> </table>.
    I will later use this to save to a database.
    Thanks
    Edited by: DJMegabit on Apr 14, 2010 7:36 PM

    Maybe give us more details about what exactly You'd like to achieve. I guess that there might be better solutions to the problem.

  • Pull data from SQL Table and display it in mail

    I have a requirement to pull the data from SQL table and send it in email.  Currently I am sending the hard coded info in email but is it possible to pull some data from SQL Table and than format it and send it across in the same email? 
    Can you guide me with steps on this.
    Neil

    There are several ways to do this.  First is to populate a file in a data flow and then send that as an attachment in the send mail task. 
    As far as including the results in the email body this becomes a bit trickier.  To use a variable you would need to use an SSIS variable type of
    Object, this is similar to a collection in .NET.  The problem once the object is populated is that it isn't like a readable result set, but again more like an array or a collection.  There is no native method to take the object variable and
    specify .ToString() or cast its results as text.  You would need to iterate through each row and append it to another variable of type string, this could be done with a script task or ForEach container.
    Also you mentioned formatting the results.  What type of formatting were you looking for.  A limitation of the SMTP send mail task is that the message body doesn't support HTML so if you were looking at creating a table within the mail body you
    would have to use a script task or a custom component
    David Dye My Blog

  • Using ABAP DATA FLOW to pull data from APO tables

    I am trying to use an ABAP Data flow to pull data from APO and receive error 150301. I can do a direct table pull and receive no error, but when I try to put it in an ABAP data data flow I get the issue. Any help would be great.

    Hi
    I know you "closed" this, however someone else might read it so I'll add that when you use an ABAP dataflow, logic can be pushed to ECC - table joins, filters, etc.  (Which can be seen in the generated ABAP).
    Michael

  • Is there any datasource available to pull data from NAST table?

    The field I am trying to pull out of NAST (Message Status) table is NACHA. Please provide me hints if any Business Content Datasource uses this table or we have to create a custom extractor for the same?
    Regards,
    Joy

    I dont think there is a standard business content datasource to extract data from NAST table. If you are going to use this data in some other LO modules based on the requirement enhance the datasource and append fields and write code to populate the message types.
    If you are going to use this as stand alone data, then you can go ahead and create a generic datasource based on table.

  • Using a substitution variable to pull data from a table

    Hello,
    I am working with a simple program that asks the user to enter any info that will relate to a table in the db.
    Thus far I have read 1,000 ways to accomplish this, and none of them work.
    PROMPT
    ACCEPT var PROMPT 'Enter var'
    DECLARE
    BEGIN
    SELECT &var
    FROM &table
    WHERE var=tablevar;
    END;

    Thanks for the feedback. Though I understand your logic, it doesn't seem to properly apply here. This is a more detailed explanation of what I've done.
    First, I create the table
    CREATE TABLE starbright
    (planet_num VARCHAR2(3),
    planet VARCHAR2(20));
    INSERT INTO starbright VALUES
    (257, 'Neptune');
    INSERT INTO starbright VALUES
    (367, 'Venus');
    INSERT INTO starbright VALUES
    (586, 'Mars');
    INSERT INTO starbright VALUES
    (725, 'Earth');Now, with that table created, I want to be able to periodically use PL/SQL to call data from the table, such as below
    DECLARE
    p_no := '&planet_num';
    BEGIN
    INSERT p_no
    INTO starbright;
    SELECT planet_num
    INTO p_no
    FROM starbright
    WHERE planet_num := p_no;
    dbms_output.put_line( 'Result: ' || planet );
    END;This is my generic error
    Error report:
    ORA-06550: line 2, column 6:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
       constant exception <an identifier>
       <a double-quoted delimited-identifier> table LONG_ double ref
       char time timestamp interval date binary national character
       nchar
    The symbol "<an identifier>" was substituted for "=" to continue.
    ORA-06550: line 6, column 8:
    PLS-00103: Encountered the symbol "P_NO" when expecting one of the following:
       into <a SQL statement>
    ORA-06550: line 11, column 18:
    PLS-00103: Encountered the symbol "=" when expecting one of the following:
       . ( * @ % & = - + ; < / > at for in is mod remainder not rem
       <an exponent (**)> <> or != or ~= >= <= <> and or like LIKE2_
       LIKE4_ LIKEC_ between group h
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:

  • How to Pull Data From CRT table PCL2 Cluster

    Hi,
    I want to show a Report, below is the Fields in the Report 
    <b>Descripton</b>----
    <b>Table Name</b>
    Total Current Month Salary----
    CRT table PCL2 cluster
    monthly member contribution-----CRT table PCL2 cluster
    Net difference in Pay----
    CRT table PCL2 cluster
    How to get the Data from the CRT table PCL2 cluster in BW
    is there any procedure to get the payroll data in BW?
    I think CRT table is a internal Table.
    any good idea's will be appricated...
    Thanks
    Priya

    Hi,
    check whether is it populating when u call
    Function Module  - PYX X_READ_PAYROLL_RESULT .
    If not Use this Marcro.
    RP-IMP-C2-IN.
    Call this macro and check EPF[ ].This marco will populate both RT and EPF.
    Check transaction - PC00_M40_ EPF
    Cheers,
    Manoj.

  • The data from a table of a database are not retrieved in ADF BC Application

    I have two separate ADF BC applications. Each application retrieve
    the data from the same scheme of a database. Both applications work
    well when I launch them under embedded OC4J. I have deployed
    these applications to a standalone OC4J. When I launch one application,
    the data from a database's table are retrieved. When I launch the other
    application, the data from a database's table are not retrieved. Why? Please,
    help me.

    Any error message ?
    Frank

  • Unable to read data from Temporary table

    Hello
    Iam calling a stored procedure in java which populates data into a temporary table. This temporary table is reset for each session. The issue is that the procedure is executed successfully but when I run a select query on the temp table, it shows 0 rows.
    When i execute the same procedure from TOAD or MSSQL, the temp table is populated successfully.
    Any Suggestion on what is the possible error
    tnx
    -S-

    Temp table exists for duration of session.
    Make sure you are using the same session.

  • Footer needs to pull data from main table

    Hi Gurus,
    I need to have a footer which displays the value of a tag from the main table in BI publisher. The main table in the BI Publisher has the customer information and the address information of the customer needs to print on the footer of the page that displays the customer. This address would change for each customer. There must be a way to do this. I searched through the BI Publisher forum but couldnt find any way to do this. Could you pls help.
    Thanks,
    Swarna

    hi Paolyn,
    We can't insert data's from table using publisher desktop
    just double click on the footer part and added the data with the following format
    <?CUSTOMERNAME?>
    <?CUSTOMERNUMBER?>
    The tag value should be in upper case
    then close the footer and try that
    Thanks,

  • Unable to retrive data from two tables using multiple joins

    Hi,
    Table:   EMP mgr 
    eid              name
    eid mgrid
    1
    A 1
    null
    2
    B 2
    3
    3
    C 3
    3
    i need to get result as:
    eid ename mgrname
    thanks
    AVS

    Sai,
    It would be very helpful if you could mention your table structures a bit more clearly. Would allow for effective replies from fellow users as well. :) 
    However, assuming that your structure would be as follows presenting the query as below:
    DECLARE @Emp TABLE(Eid Int, ename Varchar(50))
    DECLARE @Emp_Mgr TABLE(Eid int, mgrid int null )
    INSERT INTO @Emp select 1,'Ram'
    INSERT INTO @Emp select 2,'Shyam'
    INSERT INTO @Emp_Mgr select 1,NULL
    INSERT INTO @Emp_Mgr select 2,1
    SELECT * FROM @Emp
    SELECT * FROM @Emp_Mgr
    Query to print results as EID, ENAME, MGRNAME
    SELECT em.eid,e1.ename as ENAME,e2.ename as MGRNAME
    FROM @Emp_Mgr em
    JOIN @Emp e1 ON em.eid=e1.eid
    JOIN @Emp e2 ON em.mgrid=e2.eid
    However, as you see this approach of maintaining two tables for preserving the employee-manager data is redundant and makes the queries unnecessarily complex. So, you could opt for the widely used single table format as mentioned by Praveen as well. Check
    if this helps you..
    Recommended Structure
    *Avoidance of redundant storage of data
    *Lesser Joins in queries
    DECLARE @Emp TABLE(Eid Int , Ename Varchar(50) , mgrid int null )
    INSERT INTO @Emp(Eid , ename , mgrid) values(1 , 'Ram' , null) , (2 , 'Shyam' , 1)
    SELECT * FROM @Emp
    Query to print results as EID, ENAME, MGRNAME
    SELECT e.Eid , e.Ename , m.Ename as MgrName
    FROM @Emp e
    JOIN @Emp m On a.mgrid = b.eid
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Need Help Pulling Data from Oracle Table (Newby)

    Let me start of by saying I'm very new to Java so the code may be messy/poorly coded (I'm trying!). However, I've come a long way already and the code is almost working (it compiles and returns what I expect in one case). What I'm trying to do is prompt the user to enter a type, then a key. I use that type to determine the SQL statement to use then I use the key as part of the SQL statement.
    If I enter 'custnum' as the type, then a string as my key, it finds the record fine.
    If I any of my other valid types (lname, address or phone) and then enter my key, the result set is empty. I've verified that there are matching records for the type/key I'm entering.
    I've tried stepping it through the debugger and looking at various variables along the way both with the working scenario and the not-working scenario, but I can't find anything. I'm sure it's a simple coding mistake, but I don't really know how to track it down.
    Any ideas on what's going wrong would be greatly appreciated. Thanks!
    //Start code
    import java.sql.*;
    import java.util.Scanner;
    public class AccessCustomerTable
    private static final String DEFAULT_DRIVER = "oracle.jdbc.driver.OracleDriver";
    private static final String DEFAULT_URL = "jdbc:oracle:thin:@hostname.com:1521:orap1";
    private static final String DEFAULT_USERNAME = "username";
    private static final String DEFAULT_PASSWORD = "password";
    //Set the SQL statements
    private static final String SQLCUSTOMER_CUSTNUM =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUSTNUM=?";
    private static final String SQLCUSTOMER_CUST_LNAME =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUST_LNAME=?";
    private static final String SQLCUSTOMER_CUST_PHONE =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where CUST_PHONE=?";
    private static final String SQLCUSTOMER_EMAIL =
    "select CUSTNUM,CUST_LNAME,CUST_FNAME,CUST_PHONE,EMAIL,STAT_LVL,HH_NUM " +
    "from EME.CUSTOMER " +
    "where EMAIL=?";
    private static final String SQLDETAIL =
    "select TRANS_DATE,STORENUM,TERMINAL,TRANSID,OPERATOR,SALES_TOT," +
    "AMOUNT_SPENT,AUTO_CPNS,PTS_EARNED,PTS_REDEEMED,RDMT_CPNS,ADD_CPNS," +
    "USED_CPNS,OFFLINE_ALT_ID,RECON_IND " +
    "from EME.CUSTOMERDETAIL " +
    "where CUSTNUM=?";
    private static final String SQLHOUSEHOLD =
    "select PGM_PTS,PERIOD_PTS,PGM_RDM,PERIOD_RDM,SALES_TOT,AUTO_CPNS," +
    "CARD_UCNT,MESSAGE,DISC_GRP,PT_MULTP,USERFEAT1,USERFEAT2,USERFEAT3,TARG_CPNS " +
    "from EME.HOUSEHOLD " +
    "where HH_NUM=?";
    public static void main(String[] args)
    Connection conn = null;
    PreparedStatement stmt = null;
    ResultSet rset = null;
    //declare all variables
    String custNum = "";
    String custLNm = "";
    String transDt = "";
    String storeNum = "";
    String pgmPtsEarned = "";
    String periodPtsEarned = "";
    try {
    //********** Get Customer Data **********
    householdNum = "";
    Class.forName(DEFAULT_DRIVER);
    conn = DriverManager.getConnection(DEFAULT_URL,DEFAULT_USERNAME,DEFAULT_PASSWORD);
    String lookupType = getUserInput("Lookup Type");
    if (lookupType.toUpperCase().equals("CUSTNUM"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUSTNUM);
    else if (lookupType.toUpperCase().equals("LNAME"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUST_LNAME);
    else if (lookupType.toUpperCase().equals("PHONE"))
    stmt=conn.prepareStatement(SQLCUSTOMER_CUST_PHONE);
    else if (lookupType.toUpperCase().equals("ADDRESS"))
    stmt=conn.prepareStatement(SQLCUSTOMER_EMAIL);
    else
    //stop execution with message
    System.out.println("Invalid lookup type entered. Process stopping");
    System.exit(0);
    String lookupKey = getUserInput("Lookup Key");
    System.out.println("Lookup Key is " + lookupKey);
    stmt.setString(1,lookupKey);
    rset = stmt.executeQuery();
    //what if rset returns no records?
    boolean empty=true;
    while (rset.next())
    empty=false;
    custNum = rset.getString(1);
    custLNm = rset.getString(2);
    if (empty)
    System.out.println("No records found for " + lookupKey);
    System.exit(0);
    //********** Get Detail Data **********
    stmt=conn.prepareStatement(SQLDETAIL);
    //stmt.setString(1,customerId);
    stmt.setString(1,custNum);
    rset = stmt.executeQuery();
    empty = true;
    while (rset.next())
    empty = false;
    transDt = rset.getString(1);
    storeNum = rset.getString(2);
    if (empty)
    System.out.println("No detail records found for customer # " + custNum);
    System.exit(0);
    //********** Get Household Data **********
    stmt=conn.prepareStatement(SQLHOUSEHOLD);
    stmt.setString(1,householdNum);
    rset = stmt.executeQuery();
    empty = true;
    while (rset.next())
    empty = false;
    pgmPtsEarned = rset.getString(1);
    periodPtsEarned = rset.getString(2);
    if (empty)
    System.out.println("No household records found for " + householdNum);
    System.exit(0);
    catch(Exception x)
    System.out.println(x.getMessage());
    x.printStackTrace();
    finally
    close(rset);
    close(stmt);
    close(conn);
    private static void close(Connection conn)
    try
    if (conn != null)
    conn.close();
    catch (SQLException e)
    e.printStackTrace();
    private static void close(Statement stmt)
    try
    if (stmt != null)
    stmt.close();
    catch (SQLException e)
    e.printStackTrace();
    private static void close(ResultSet rset)
    try
    if (rset != null)
    rset.close();
    catch (SQLException e)
    e.printStackTrace();
    public static String getUserInput(String getVal)
    Scanner sc = new Scanner(System.in);
    //for now, I'll be expecting "CustNum", "LName", "Phone", "Address"
    System.out.println("Enter " + getVal + ": ");
    String returnStr = sc.nextLine();
    return (String) returnStr;
    }

    You're new to Java, so you can be forgiven. You actually tried to do some good things, like close resources. Good for you.
    Do yourself a favor and start trying to think in terms of objects.
    Let's call that class CustomerTableGateway.
    Let's write separate methods for each kind of SQL statement you have.
    Get the logic out of the main method. It's almost useless there.
    There's a computer science principle called DRY - Don't Repeat Yourself. When you see code being repeated, see if you can find a way to rewrite it so you only do it once.
    I'd recommend that you start with a Customer class. Figure out how to map a row from your CUST table into the Customer object. Have an interface that would look like this:
    public interface CustomerDao
        Customer findById(String id);
        List<Customer> findByLastName(String lastName);
        List<Customer> findByName(String firstName, String lastName);
        List<Customer> findByEmail(String email);
        List<Customer> findByPhone(String phone);
    }Have another interface called RowMapper:
    public interface RowMapper
        Object map(ResultSet rs);
    }An implementation for one of those methods might look like this:
    public Customer findById(String id)
         Customer customer = null;
         PreparedStatement stmt = null;
         ResultSet rs = null;
         try
             stmt = this.connection.prepareStatement(FIND_CUSTOMER_BY_ID);
             stmt.setString(1, id);
             rs = stmt.executeQuery();
             while (rs.next())
                 customer = (Customer)this.customerMapper.map(rs);
        catch (SQLException e)
            e.printStackTrace();
        finally
            DatabaseUtils.close(rs);      // move those nice close methods into a utility class so you can reuse them.
            DatabaseUtils.close(stmt);
        return customer;
    }You did a pretty good job. Just go further.
    %

  • Copying data from a table in the Database to an internal table.

    Hello,
    How do I copy data that is a table that is in the database and and then load the data to an internal table in the ABAP/4 Aditor.
    Please help.

    hi,,
    do this way ...
    tables : mara.
    parameters : p_matnr like mara-matnr,
    start-of-selection.
    select <fields>  from mara into table it_mara
         where matnr = p_matnr.
      if sy-subrc = 0.
    endif.

  • UNIQUE Problem in pulling DATA from DATA base table to internal table

    Dear Experts,
    I am new to ABAP. I have a very basic question but looks a quite puzzling one to me. Hemnce I am posting it here.
    I am facing an unique problem in pulling data from database table and populating that data into internal table for further use.
    The data in the database table "Zlt_mita" with fields M1 (Employee Name, Type: Char20) and M2 (Employee Code, Type Char7) are:
    Plz refer the screenshot in the attached file:
    My Code:
    1) When I try to pull data from Dbase table by taking M2 as parameter.
         This code is succcessful and I am able to populate data in internal table it_dat.
    TYPES: Begin Of ty_DAT,
                     M1   TYPE  Zlt_mita-M1,
                     M2   TYPE  ZLT_mita-M2,
                 END  OF  ty_DAT.
    DATA: it_dat        TYPE STANDARD TABLE OF ty_dat with header line,
              wa_dat      TYPE   ty_dat.
    PARAMETERS: p_mitar    TYPE  Zlt_Mita-M2.
    SELECT           M1
                           M2
            FROM     ZLt_mita
            INTO       TABLE it_dat
            Where     M2 = p_mitar.
    Loop at it_dat into wa_dat.
       WRITE:/2 wa_dat-M1,
                  10 wa_dat-M2.
    ENDLOOP.
    2) When I try to pull data from Dbase table by taking M1 as parameter.
         This code is NOT succcessful and I am NOT able to populate data in internal table it_dat.
    TYPES: Begin Of ty_DAT,
                     M1   TYPE  Zlt_mita-M1,
                     M2   TYPE  ZLT_mita-M2,
                 END  OF  ty_DAT.
    DATA: it_dat        TYPE STANDARD TABLE OF ty_dat with header line,
               wa_dat      TYPE   ty_dat.
    PARAMETERS:    P_Mita    TYPE   ZLT_Mita-M1.
    SELECT           M1
                           M2
            FROM     ZLt_mita
            INTO       TABLE it_dat
            Where     M1 = P_Mita.
    Loop at it_dat into wa_dat.
       WRITE:/2 wa_dat-M1,
                 10 wa_dat-M2.
    ENDLOOP.
    Why is this happening when both M1 and M2 are Type Character fields.
    Looking forward for your replies.
    Regards
    Chandan Kumar

    Hi Chandan ,
    Database fetch is case sensitive ,So u need to give exact format in where condition.
    Make your parameter and database in same case so that you need not worry about case sensitivity .
    Check the lowecase check box in the domain .
    Then declare your parameter 
    PARAMETERS:
    P_Mita
    TYPE   ZLT_Mita-M1 LOWER CASE . 
    You can do the vice versa also by unchecking lowercase and giving Upper case instead of lower in parameter declartion .
    Regards ,
    Juneed Manha

Maybe you are looking for