Replaced Table with Command, now have duplicate records

Hi all,
I'm not sure if there is a problem with my command, or if I'm not doing something correctly within Crystal itself.
I replaced a table with a command. The command is filtering the dataset as I wanted but for some reason I'm getting duplicate records in the report. I tried using the Distinct keyword, but that doesn't seem to help.
Any suggestions?
SELECT DISTINCT BI_CLOSE_DT, BI_OPEN_DT, BI_SO_COM, BI_SO_NBR, BI_ACCT, BI_SO_DET_KEY,BI_SO_STAT_CD, BI_SO_TO_ACCT, BI_SO_TO_CUST_NBR, BI_SO_TYPE_CD, BI_SRV_LOC_NBR
FROM BI_SO_DET
WHERE (BI_SO_STAT_CD = 'X'
and BI_SO_TYPE_CD IN  ( 'NEW', 'NCBM', 'NEW-WF' )
and BI_SO_TO_ACCT IS NOT NULL)

.. coworker helped me realize the data was actually correct; I was getting the complete dataset as I should with duplicates and just needed to filter out the duplicates by using the grouping function on the unique id. All good now

Similar Messages

  • Replace table with command

    Hi,
    In Crystal Reports 9 and above, I'd like to replace a table in my report with a sql command, which has exactly the same fields.
    I've tried in the "Set datasource location" with the "Update" button and inserting the sql command, but I get no visible result.
    How can I achieve this?
    Thanks

    Hello,
    No option, the complexity of doing this to much so it's never been added. And in CR 9 it was the first version of Commands. In CR 2008 and using the SDK in an application you write you can convert up to 2 tables to a command object SQL statement.
    Any more than 2 tables and your only option is to have the old and new reports open and copy and paste objects.
    No version has the option in the Designer.
    If you have a developer available then that person can use this code to do so, this only does one table but can be modified for 2 tables:
            private void TableToCommand_Click(object sender, EventArgs e)
                CrystalDecisions.CrystalReports.Engine.ReportDocument rpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
                ISCDReportClientDocument rcd;
                rcd = rptClientDoc;
                rptClientDoc.DatabaseController.LogonEx("ServerName", "xtreme", "sa", "pw");
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConninfo;
                CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
                CrystalDecisions.ReportAppServer.DataDefModel.Table oldTbl;
                CrystalDecisions.ReportAppServer.DataDefModel.CommandTable newTbl = new CommandTable();
                oldTbl = (CrystalDecisions.ReportAppServer.DataDefModel.Table)rcd.Database.Tables[0];
                oldConninfo = oldTbl.ConnectionInfo.Clone(true);
                GroupPath gp = new GroupPath();
                gp.FromString("");
                string sql = String.Empty;
                rptClientDoc.RowsetController.GetSQLStatement(gp, out sql);
                PropertyBag QEProps = new PropertyBag();
                PropertyBag logonProps = new PropertyBag();
                //Set the attributes for the logonPropsBag
                logonProps.Add("Database", "xtreme");
                logonProps.Add("DSN", "ServerName");
                logonProps.Add("UseDSNProperties", "False");
                //Set the attributes
                QEProps.Add("Database DLL", "crdb_odbc.dll");
                QEProps.Add("QE_DatabaseName", "xtreme");
                QEProps.Add("QE_DatabaseType", "ODBC (RDO)");
                //Add the QE_LogonProperties we set in the logonProps Object
                QEProps.Add("QE_LogonProperties", logonProps);
                QEProps.Add("QE_ServerDescription", "ServerName");
                QEProps.Add("QE_SQLDB", "True");
                QEProps.Add("SSO Enabled", "False");
                newConnInfo.Attributes = QEProps;
                newConnInfo.UserName = "sa";
                newConnInfo.Password = "pw";
                newConnInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
                newTbl.ConnectionInfo = newConnInfo;
                newTbl.CommandText = sql;
                newTbl.Name = "Command";
           //     foreach(CrystalDecisions.ReportAppServer.DataDefModel.Table tbl in rcd.Database.Tables)
                    rcd.DatabaseController.SetTableLocationEx(oldTbl,newTbl);
                    oldTbl =(CrystalDecisions.ReportAppServer.DataDefModel.Table) rcd.Database.Tables[0].Clone(true);
                    rcd.DatabaseController.SetTableLocationEx(oldTbl, newTbl);
                // save the report to a new folder
    Thank you
    Don

  • Ios 6 on 4s and now have duplicate and merged contacts

    updated to ios 6 on 4s and now have duplicate and merged contacts how do I resolve?

    I have a number of clients who have this issue since the iOS6 update (as do I on my personal iPhone). These are the steps I took. The combination is that they were using iCloud / iPhone with their contacts.
    Log into www.icloud.com and see if you have any duplicatesI had no duplicates here
    Check Outlook (if you use this) to see if you have any duplicatesI had no duplicates here
    On your iPhone check to see if you have duplicatesI had duplicates here
    On my iPhone, I went to Settings, iCloud, and TURNED OFF the CONTACTS switch. Then it asked me if I want to keep my contacts on the phone... In my case, I did not as I know all of my contacts are stored in iCloud as I've confirmed that in STEP 1 & 2.
    In your iPhone, check your Contacts, it should be empty.
    Go back to Settings, iCloud, and TURN ON the CONTACTS switch. This will redownload all of your contacts from iCloud without the duplicates.
    I hope this helps as this was kind of annoying as there was no reason for my contacts to be duplicated as I did not choose to integrate using the Facebook option.

  • Since using sync I now have duplicate bookmarks, but if I delete one bookmark it deletes it's duplicate too, how do I get rid of this second set of bookmarks?

    ''dupe of https://support.mozilla.org/en-US/questions/934187''
    Since using sync I now have duplicate bookmarks, but if I delete one od the duplicate bookmarks it also deletes the original, how do I get rid of this second set of bookmarks?

    The places.sqlite database may still be corrupted if the same bookmarks show in different locations.

  • Multiple tables with the possibility of multiple records in each table

    Post Author: viper
    CA Forum: .NET
    Hi
    I have been trying for a few days now to come up with a CR solution to displaying data from multiple tables.  These tables, in some cases, have more then one record that needs to be displayed.  This is basically what I am trying to do.....
    I am developing a .net web application(vb) using vs2005 and an oracle 10g backend.  There is a data entry part of the site that users will enter data related to a property.  Other users will be able to search these records and have a list of records returned based on the search criteria.  The user then can click on one of these records to view a pop up CR report containing all the data related to that one property.  The PropID is passed to the pop up page and is used in the WHERE clause of my SQL statement to bring back only one property.  This data can come from as many as 18 tables if all the fields have been entered for this property.  I have tried many different solutions to get the data from multiple tables...and have had some that were close to what I need.  The best one I have will display data from multiple tables but only one record per table.....which doesn't work in my case since some of the tables have more then one record per table.
    Is there anybody that has had success in setting up similar reports?
    Does anybody know how I could use the "Group Expert" to group by the tables in my application?  I can only figure out how to group within a single table.
    It would be great if I could group by table....then just display the record(s) in each table that had the same PropID.  I am not sure if the pdf export would show all the data in that situation but it would be worth a try.  If fact...maybe I could create a new table called MyTables and just add two colums like MyTableID and MyTableName.  Then add all the table names to MyTables that I want to see in the report and add the associated MyTableID value to each table as a new column.  I could then group by MyTableID and PropID.  Just guessing here.
    Any ideas would be appreciated.

    Post Author: quafto
    CA Forum: .NET
    Your query is not too clear so I'll do my best to answer it broadly.
    You mentioned that you have a .NET web application where your users enter data on one screen and then may retrieve it on another. If the data is written in real time to a database then you can create a standard Crystal Report by adding multiple tables. The tables should be linked together using the primary and foreign keys in order to optimize the database query and give you a speedy report. Using unlinked tables is not recommended and requires the report engine to index the tables (it is quite slow).
    You also mentioned you have a "PropID" to be used in a WHERE clause. This is a great place to use a parameter in your report. This parameter can then be used in your record selection formula inside Crystal Reports. The report engine will actually create the WHERE clause for you based on the parameter value. This is helpful because it allows you to simply concentrate on your code rather than keeping track of SQL queries.
    Now, what Crystal does not do well with is uncertainty. When you design a report with X number of tables the report engine expects X number of tables to be available at processing time. You should not surprise the print engine with more or less tables because you could end up with processing errors or incorrect data. You may need to design multiple reports for specific circumstances.
    Regarding the group expert question. I'm not sure how you would/could use the group expert to group a table? A table is a collection of fields and cannot be compared to another table without a complex algorithm. The group expert is used to group and sort records based on a field in the report. Have a look at the group expert section of the help file for more information.
    Hopefully my comments have given you a few ideas.

  • USE of PREVIOUS command to eliminate duplicate records in counter formula

    i'm trying to create a counter formula to count the number of documents paid over 30 days.  to do this i have to subtract the InvDate from the PayDate.   and then create a counter based on this value.  if {days to pay} is greater than 30 then 1 else 0.
    then sum the {days to pay} field to each group.   groups are company, month, and supplier.
    becuase invoices can have multiple payments and payments can have multiple invoices. there is no way around having duplicate records for the field. 
    so my counter is distorted by by the duplicate records and my percentage of payments over 30 days formula will not be accurate do to these duplicates.
    I've tried Distinct Count based on this formula  if {days to pay} is greater than 30 then . and it works except that is counts 0.00 has a distinct records so my total is off 1 for summaries with a record that (days to pay} is less than or equal to 30.
    if i subract 1 from the formula then it will be inaccurate for summaries with no records over 30 days.
    so i'm come to this.
    if Previous() do not equal
    then
      if {day to days} greater than 30
      then 1
      else 0.00
    else 0.00
    but it doesn't work.  i've sorted the detail section by
    does anyone have any knowledge or success using the PREVIOUS command in a report?
    Edited by: Fred Ebbett on Feb 11, 2010 5:41 PM

    So, you have to include all data and not just use the selection criteria 'PayDate-InvDate>30'?
    You will need to create a running total on the RPDOC ID, one for each section you need to show a count for, evaluating for your >30 day formula. 
    I don't understand why you're telling the formula to return 0.00 in your if statement.
    In order to get percentages you'll need to use the distinct count (possibly running totals again but this time no formula). Then in each section you'd need a formula that divides the two running totals.
    I may not have my head around the concept since you stated "invoices can have multiple payments and payments can have multiple invoices".  So, invoice A can have payments 1, 2 and 3.  And Payment 4 can be associated with invoice B and C?  Ugh.  Still though, you're evaluating every row of data.  If you're focus is the invoices that took longer than 30 days to be paid...I'd group on the invoice number, put the "if 'PayDate-InvDate>30' then 1 else 0" formula in the detail, do a sum on it in the group footer and base my running total on the sum being >0 to do a distinct count of invoices.
    Hope this points you in the right direction.
    Eric

  • Handling internal table with more than 1 million record

    Hi All,
    We are facing dump for storage parameters wrongly set.
    Basically the dump is due to the internal table having more than 1 million records. We have increased the storage parameter size from 512 to 2048 , still the dump is happening.
    Please advice is there any other way to handle these kinds of internal table.
    P:S we have tried the option of using hashed table, this does not suits our scenario.
    Thanks and Regards,
    Vijay

    Hi
    your problem can be solved by populating the internal table in chunks. for that you have to use Database Cursor concept.
    hope this code helps.
    G_PACKAGE_SIZE = 50000.
      * Using DB Cursor to fetch data in batch.
      OPEN CURSOR WITH HOLD DB_CURSOR FOR
             SELECT *
               FROM ZTABLE.
        DO.
        FETCH NEXT CURSOR DB_CURSOR
           INTO CORRESPONDING FIELDS OF TABLE IT_ZTABLE
           PACKAGE SIZE G_PACKAGE_SIZE.
        IF SY-SUBRC NE 0.
          CLOSE CURSOR DB_CURSOR.
          EXIT.
        ENDIF.

  • Updating table with more than 50 million records

    Hi Team,
    Updating three columns in a table which has 60 millions of records is taking a lot of time. How to improve the performance of the query. The table has to be updated based on the values from different database tables.
    Thanks,
    Eshwar.
    Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.

    Split them into small batches
    when you are using multiple tables, have them with JOINs
    have the corresponding indexes for joining columns
    disable triggers if any (if possible and doesnt affect your logic - wud be least favourable step ..)
    also these shud help:
    http://blogs.msdn.com/b/repltalk/archive/2011/10/10/lessons-learned-updating-100-millions-rows.aspx
    http://www.sqlservergeeks.com/blogs/AhmadOsama/personal/450/sql-server-optimizing-update-queries-for-large-data-volumes
    http://stackoverflow.com/questions/7344984/update-large-number-of-rows-sql-server-2005
    Thanks,
    Jay
    <If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>

  • Swapped drive with SSD, now have to use option key to boot

    I recently replaced my HD in my Macbook Pro with an SSD.  I used SuperDuper to create an image to an external USB drive that I had.  I then removed the stock HD from the Macbook Pro, replaced it with the SSD, booted with the Lion install disc and went into disk utility, created a partition (Journaled, guid) and restored my SuperDuper image to it.  Now, every time I reboot my MBP, it sits at the gray screen (no apple logo) for quite a while, then finally the apple will pop up and it will boot, although quite slowly.  If I hold down the option key when I reboot, the option comes up right away for the SSD, I click it and it's very fast to boot.  Once in the OS, the speed is awesome and no problems.  I also used Onyx to check the startup volume, repair permissions, etc and everything went off without a hitch.  No errors and according to that my startup volume is OK.  Also updated to the latest 10.7.2 patch and that went fine too, although I had to use the option key on reboot.
    Does anyone know what I could investigate that could be causing this boot issue.  I'd like it to boot directly into the OS quickly without the option key.  Is there somewhere that I have to specify a new primary boot device or something?

    Go into sys preferences then startup disk and check highlight the SSD and select Reboot.
    You also need to enable TRIM support.

  • Master data failed with  error `too many duplicate records'

    Dear all
    below is error message
                Data records for package 1 selected in PSA -                                             
                error                                                 4 in the update
    LOng text is giving as below
    Error              4 in the update
    Message no. RSAR119
    Diagnosis
    The update delivered the error code                                                   4.
    Procedure
    You can find further information on this error in the error message of the update.
    WOrking on BI - 7.0
    any solutions
    Thanks
    satish .a

    Hi,
    Go through these threads, they have same issue:
    Master data load: Duplicate Records
    Re: Master data info object - duplicate records
    Re: duplicate records in master data info object
    Regards
    Raj Rai

  • Had problem with DSL, now have only one tab with favicon matching that tab.

    After a storm I had a problem with my U-Verse DSL. I lost access and got a message that it may be due to a problem with the filters on my phones, fax or satellite box. I disconnected all the items that had filters. I was then able to click on a link that AT&T had sent on the message and I got a response, I previously could not get a response because I had no connection. I got pack to the pages on all my tabs by hitting the back arrow on each one. I now have only one tab with favicon matching this WEB site for that tab, the rest all have the AT&T globe. I tried refresh and also opening a new tab and then going to one of the sites.
    This problem is on a different PC that the one I am on now. It has version 21, and is Window 7 Home Premium. I have pasted the trouble shooting info from that PC.

    Hello,
    Many site issues can be caused by corrupt cookies or cache. In order to try to fix these problems, the first step is to clear both cookies and the cache.
    Note: ''This will temporarily log you out of all sites you're logged in to.''
    To clear cache and cookies do the following:
    #Go to Firefox > History > Clear recent history or (if no Firefox button is shown) go to Tools > Clear recent history.
    #Under "Time range to clear", select "Everything".
    #Now, click the arrow next to Details to toggle the Details list active.
    #From the details list, check ''Cache'' and ''Cookies'' and uncheck everything else.
    #Now click the ''Clear now'' button.
    Further information can be found in the [[Clear your cache, history and other personal information in Firefox]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • HT4236 when sycing i now have duplicate copies of my pictures, how do i delete the duplicates

    When I synced my iphone to my computer to transfer photes, they were duplicated.  How do I delete the duplicate ones?

    Hello mracole,
    I checked my "purchases" and the 7/19/13 purchases don't show up.  However, the earlier versions from usually several years back...the ones that are Matched...often do show up in my Purchases.  I suspect that somehow those REALLY purchased several year old versions were deleted and redownloaded by me so I could change them to the 256 kbps versions under iTunes Match.  They were probably 128 kbps versions originally when purchased.
    Why the earlier versions that were really purchased are now identified as Matched is puzzling.
    Why I now have Purchased versions from 7/19/13 is puzzling too...especially since these versions do NOT show up in my purchases.
    Calling Apple Support if a good idea unless someone can explain this mystery.  I might even take one of my laptops to the Apple store and show a Genius.
    Thank you very much for taking the time to respond, Mr. Luigi

  • Installed ios7 and now have duplicate photos.

    Installed ios 7. Now I have duplicate photos on Photo Stream showing up in photos. Giving me two of everything. Correction?

    Try to recalibrate the Home button:
    http://reviews.cnet.com/8301-13727_7-57373687-263/fix-home-button-delays-on-ios- devices/

  • My HD on my Macbook pro 13" is done and I replaced it with new now I cannot boot off Disc

    I had to replace my HD on my MBP 13" with new, I have been trying to boot off MAC OS X Snow Leopard install DVD 10.6 but cannot! HELP needed!

    You need to use the ORIGINAL installation disc(s) that came with your machine. The SL disc is just an upgrade disc. If you don't have the original disc(s) you can call Apple at 1-800-MYAPPLE and, with your serial number handy, order a set of original replacement discs. Cost will be about $20 + tax, I believe.
    Good luck,
    Clinton

  • I de-commissioned my previous computer and erased all my files without deactivating Premiere elements first installed on my replacement computer. I now have a laptop with elements installed but cannot activate it because it supposedly is already installed

    How can i activate the copy on my laptop without re-purchasing?

    Activating the program is different, depending on which version of the program you're using -- and you don't say which version of the program you're using.
    The program allows for two activations of the program at a time. If you've already used one activation on your new defunct computer, you'll need to contact Adobe Tech Support, explain the situation and have them release one of your activations. (Note that this is a user-to-user forum, so we aren't able to do this. You'll need to contact Adobe Tech Support.)

Maybe you are looking for

  • My itunes wont let me authorise my account for my apps?

    i have authorised three computers and got a new computer for christmas but with the others deleted/ deauthorised i now cannot authroise this one help!!

  • How do I turn a FLA into a URL Button ?

    Hiya I have a FLA file with 4 layers 2 of the layers are Text Boxes 2 of them are masks to make the different words "Shine" Is there a way to make the whole file a button so when people click on it, it goes to a different page ? Thx Paul

  • Error w/ UPDATE in Stored Procedure - ORA-06553 PLS-306

    I get the following error when executing my stored proc. from a Perl script: DBI ERROR: ORA-06553: PLS-306: wrong number or types of arguments in call to 'UPDATE_USER_PROJMGR' (DBD ERROR: OCIStmtExecute), QUERY: DBI::st=HASH(0x238cd4)Now, it's passin

  • Access database connection

    Hello: I noticed your response on the Adobe web site. I am working with Lifecycle and I am trying to connect to an access database. I step thru the setup and I get a Connection Successful message. When I open the form it finds the first record in the

  • Problems with Sony Projector

    When I connect to a Sony Projector with the adapter DVI-VGA I can only see a small part of the screen Any Ideas? Adrian Macbook pro   Mac OS X (10.4.6)