Creating Packages from BLOB field contents, line wrap problems

Good afternoon,
we use an in-house developed database-driven update system to update both our databases and filesystems, the system itself performs really well but there is still one problem I can't fix without some expert help:
the code of to-be-updated Oracle packages is stored inside of a BLOB field, the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body (I tried to execute both in a single step but this didn't work). This works for packages with less than 32767 characters and also works in some other cases but I found one case where the executed code contains an extra line wrap right in the middle of a word.
To make it more clear (I hope it's comprehensible), imagine the following database content:
CREATE OR REPLACE Package
MyPack
AS
[... a lot procedure headers ...]
END MyPack;
CREATE OR REPLACE
Package Body MyPack AS
[... a lot more procedures ...]
PROCEDURE myTest (intID OUT integer)
AS
BEGIN
  SELECT count (*) into intID FROM MyTa[--this is where the dbms_lob.substr() ends --]ble;
END;
END MyPack;My code searches for the second occurrence of the "Create or replace package", splits the code into spec and body, executes the specification and keeps on adding the rest of the code to a VARCHAR2A variable called "storedCode" from the BLOB. Now in the above example, after the specification has been removed from the string, the remaining characters (ending with the "MyTa" string) are added to the varchar2a variable, the next line is fetched from the BLOB via "dbms_lob.substr()" and added as long as dbms_lob.substr() does not return a NULL value (end of BLOB). When the code is executed after all has been fetched, the generated Package Body will contain an extra line wrap right in the middle of the "MyTable" word compiling the package invalid.
This is the procedure code I use (definitely improvable, I'm better in MSSQL and MySQL dialects ...) to load, parse and execute the BLOB content:
   -- to run package code
  procedure runPackageCode (stepRef integer)
  AS
    numLines integer default 1;
    pos     integer default 1;
    storedCode    LOG_CHANGEDOBJECT.STOREDOBJECT%type;
    objectCursor  integer;
    lSqlOut     integer;
    sqlCommand  dbms_sql.varchar2a;
    emptyCommand dbms_sql.varchar2a;
    pIsError integer := 0;
    pErrorMsg varchar2(200) := '';
    updateRef integer := 0;
    currentUpdate integer := 0;
    schemaReference varchar2(20);
    -- required to do string cutting
    strLine varchar2(32767);
    strLeftFromSlash varchar2(32767);
    strRemaining varchar2(32767);
    intDelimiterPos integer := 0;
  begin
    -- retrieve update ID
    SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
     begin
        select storedobject, change_area
        into storedCode, schemaReference
        from vw_storedobjects
        where step_id = stepRef;
     exception
      when no_data_found then
        pIsError := 1;
        pErrorMsg := 'Invalid SQL ID ' || stepRef;
        pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
     end;
      if pIsError = 0 then     
        begin
          -- change schema
          execute immediate 'alter session set current_schema = ' || schemaReference;         
          objectCursor := dbms_sql.open_cursor;   
          loop
            strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
            intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
            while intDelimiterPos > 0
            loop
              -- '/' found, execute currently stored statement
              strLeftFromSlash := substr(strLine, 1, intDelimiterPos-1);
              strLine := substr(strLine, intDelimiterPos);
              -- execute the extracted part without any '/' in it
              sqlCommand(numLines) := regexp_replace(strLeftFromSlash, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
              if (sqlCommand(numLines) is not null) then
                objectCursor := dbms_sql.open_cursor;   
                dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);
                lSqlOut := dbms_sql.execute(objectCursor);
                dbms_sql.close_cursor(objectCursor);
              end if;
              -- reset sqlCommand
              sqlCommand := emptyCommand;
              -- reset line counter and store remaining string
              numLines := 1;
              -- check for further '/'s           
              intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
            end loop;
            -- add the remaining strLine to the sqlCommand
            strLine := regexp_replace(strLine, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
   --> I assume this line breaks the code, lpad()'ing the content to move it to the end of a varchar2a line didn't help
            sqlCommand(numLines) := strLine;
            exit when sqlCommand(numLines) is null;
            pos := pos+32767;
            numLines := numLines+1;
          end loop;
          objectCursor := dbms_sql.open_cursor;   
          dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);   
          lSqlOut := dbms_sql.execute(objectCursor);
          dbms_sql.close_cursor(objectCursor);
          commit;
          -- reset schema
          execute immediate 'alter session set current_schema = UPDATE_DB';
          -- set state to installed
          pkg_update.setstepstate(stepRef, 'Installed');
    exception
    when others then
          -- reset schema
          execute immediate 'alter session set current_schema = UPDATE_DB';
          -- set state to installFailed
          pkg_update.setstepstate(stepRef, 'InstallFailed');
          pkg_generic.LogError(updateRef, 'Database', stepRef, 'Run package code failed: ' || sqlerrm);
    end;
    end if;
  END;    Thanks if you kept on reading so far, I would really appreciate any feedback!
Regards, Sascha

Welcome to the forum!
Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
Thanks for providing an easy-to-understand problem statement and for using code tags.
>
the code of to-be-updated Oracle packages is stored inside of a BLOB field
>
This should be stored in a CLOB since it is character data. Why are you using BLOB?
>
the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body
>
Good, clear problem statement. So why doesn't your code do just what you said it should do: 1) split the code into two parts, 2) execute the spec and 3) execute the body.
Instead of writing code that does these three relatively simple steps your code tries to combine splitting and executing and mushes/mashes it all together. The result, as you found, is code that is hard to understand, hard to debug, doesn't work and doesn't report on what it is doing.
Code like this doesn't have a performance issue so the code should implement the simple step-by-step process that you so elegantly stated in your problem description:
1. split the code into two parts
2. execute the spec
3. execute the body
My advice is to refactor your code to perform the above steps in the proper order and to add proper exception handling and reporting for each step. Then when a step isn't working you will know exactly where and what the problem is.
Here are my recommendations.
1. Add two CLOB variables - one will hold the spec, the second will hold the body
2. Add a comment (you have some good ones in the code now) for every step no matter how trivial it may be
3. Add exception/error handling to EVERY STEP
Your code for the first step has a comment but no exception handling. What should happen if you don't get any data? Why aren't you validating the data you get? Dynamic SQL using table-driven data is great, I love it, but you MUST validate that the data you get is what you expect to get.
    -- retrieve update ID
    SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;Recommended
    -- step 1 - retrieve update ID - This is the id that determines BLAH, BLAH, BLAH - add appropriate to tell a new developer what this ID is and what it means.
    BEGIN
        SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
    EXCEPTION
        WHEN ??? THEN -- what should happen if step 1 fails? Do it here - don't default to an exception handler that is several pages away.
    END;Your code
     begin
        select storedobject, change_area
        into storedCode, schemaReference
        from vw_storedobjects
        where step_id = stepRef;
     exception
      when no_data_found then
        pIsError := 1;
        pErrorMsg := 'Invalid SQL ID ' || stepRef;
        pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
     end;
Good - except there is no comment that says what this does - I assume that the query above and this block are the 'retrieve update ID ' step?
You log an error message and set the error flag to '1'. But since you don't want to continue why aren't you exiting the procedure and returning right here?
      if pIsError = 0 then     
        beginSo now you check the error flag and do several pages of code if there were no errors.
I don't like that 'inverted' logic.
If you don't want to continue then STOP right now! Don't make a developer scan through pages and pages of code to find out you really aren't doing anything else if there was an error.
Either put a RETURN statement in the exception handler above or change your code to
      if pIsError = 1 then     
        RETURN;
      end if;Now the rest of the code doesn' t have to be indented; you will never get there if there is an error. Check for errors after every step and exit right then as appropriate.
          -- change schema
          execute immediate 'alter session set current_schema = ' || schemaReference;         
          objectCursor := dbms_sql.open_cursor;   
          loop
            strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
            intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
            while intDelimiterPos > 0
            loopThis code mixes all of the steps together into one giant mess. You open a cursor, try to split the BLOB into spec and body and try to parse and execute both all within a double nested loop.
Even if that works correctly another developer will have a hard time understanding what the code is doing and fixing it if it goes wrong. And it will go wrong if you let me test if for you because I will put garbage into the BLOB for the spec, body or both to make sure it breaks and to see how your code handles it.
I suggest you rewrite this double nested loop to perform the three steps separately.
1. split the code into two parts
a. put the spec into one new CLOB variable and the body into the other.
b. use DBMS_OUTPUT (or a work table) to output the spec and body so you can see what the code is and make sure the 'split' process worked properly. You probably created that BLOB by manually concatenating the SPEC and BODY to begin with so now create a SPLIT process to split them again and give them back to you. This is such a fundamental component that I suggest creating a new SPLIT_MY_BLOB procedure. This procedure would take a BLOB and return two CLOBS as OUT parameters: one CLOB is the spec and one is the body. Then you can reuse this 'split' procedure in other code or more complex versions of code. Modular programming is the key.
2. execute the spec - Now have a step that executes the spec and does something appropriate if the step succeeds or if it fails. I mean, do you really want to do execute the body if the spec execution fails? What do you want to do? Should you delete the body and spec? If you don't you might wind up with an INVALID body based on old code and an INVALID spec based on the new code you were trying to use. How will anyone, including you, know that the spec and body in the ALL_SOURCE view is really two different versions of things?
This suggests that for your use case you may want to consider DROPPING the entire package, spec and body, before trying to recreate them both. At least if the package is totally missing anyone will know that the entire thing needs to be put back. Ahhhh - but to do that you need to know the package name so you can drop it. Than may require adding another step to get the package name from your data-driven table and adding a DROP PACKAGE step.
3. execute the body - This step executes the body. Hmmmm - we have two nearly identical steps. So why don't you create a new function/procedure that takes a CLOB as input, uses dynamic sql to execute it and returns a result code. That would be useful. Then you could execute ANY sql stored in a CLOB and have a generic function that you can use for other things.
Right now you are using the VARCHAR2 table version of DBMS_SQL.PARSE but you would change this to use the CLOB version.
The end result of this refactoring is a main function/procedure that acts as the CONTROL - it decides what to do and what data (BLOB) to do it with. But it doesn't actually do ANY of the work. It just controls what is done.
And you have a couple of generic, reuseable functions that actually do the work. One knows how to split a CLOB into spec and body. The other knows how to use dynamic SQL to execute a CLOB.
Now you have a modular architecture that is easy to understand, easy to code and easy to test.

Similar Messages

  • Display image from BLOB field (png image)

    Hello,
    On my database i have a function which return BLOB (png image from a webservice)..
    Is there some tutorial or sample code how to display a image froma blob field in oracle reports?
    thank you

    You can create a view and base your report on that view. The view would be something like:
    create or replace view my_view as
    select my_blob_function() image
    from ...In your Report it would just be:
    select image
    from my_viewNow, I'm not sure if Reports supports png format, though.
    There are many examples to be found, e.g.
    http://download.oracle.com/docs/html/B10602_01/orbr_dyngraph.htm

  • ORA-12571 error while creating packages from Windows clients

    Hello,
    We are facing the ORA-12571 error while creating / replacing packages from Windows Clients connected to a 8.1.7.2.0 db on a Solaris server.
    However, there are
    1. no errors in connecting and creating transactions from a Sql session
    2. no errors in creating / replacing unwrapped/wrapped small (few lines) packages
    3. no errors in connecting from a Unix session (remote telnet sessions inclusive).
    This happens only when creating wrapped/unwrapped packages, source code of which is greater than 500 kb approx.
    Can somebody help me resolve this issue. Any Help would be greatly appreciated.
    Regards.
    Lakshmanan, K

    Update: I had unintentionally left my custom tablespace in READONLY state after an earlier experiment with transportable tablespaces. After putting the tablespace back into READ WRITE mode and creating a new template, I was successfully able to create a new db from the template.
    I'm still a little curious why this procedure wouldn't work properly with a READONLY tablespace, however.
    Ben

  • Retrieve XMLP documents directly from BLOB fields in E1; Tools Release 8.97

    Hi,
    I want to be able to retrieve XML Publisher reports (PDF, RTF, HTML) directly from the database BLOB fields in EnterpriseOne. Instead of making users manually save each report to get a soft-copy of the report, I wanted to be able to retrieve the reports from a BLOB field, create a new external file for it, and open the file with the related editor (MS Word, Adobe, IE, etc.).
    We are on Oracle 10g, and I was able to get a file populated with some BLOB data for a particular RTF file. However, when I try to open the file in MS Word, all I get is junk.
    Does anyone know if JDE stores these documents differently into BLOB fields than standard?
    Here is the code I used using PL/SQL...
    DECLARE
    xmlstr BLOB;
    warn VARCHAR2(400);
    v_file Utl_File.file_type;
    line_buf RAW(32767);
    maxbufsize BINARY_INTEGER := 32767;
    amount BINARY_INTEGER;
    offset BINARY_INTEGER;
    dir varchar2(50) := 'XMLP_DIR';
    filename varchar2(50) := 'JPARK_TEST.rtf';
    bsize NUMBER;
    BEGIN
    v_file := utl_file.fopen(dir,filename,'wb',maxbufsize);
    SELECT xorpdxpblb INTO xmlstr FROM sy812.F95631 WHERE xorpdorgud = '2115630440008e-SMNQTWZCFI-YEKRWCIOUA';
    --SELECT xdrpdubblb INTO xmlstr FROM sy812.F95630 WHERE xdrpduogud = '21080156900001-SMNQTWZCFI-ORORNYFSYJ';
    bsize := dbms_lob.getLength(xmlstr);
    dbms_output.put_line(bsize);
    amount := maxbufsize;
    offset := 1;
    WHILE (offset<bsize) LOOP
    DBMS_LOB.read(xmlstr,amount,offset,line_buf);
    utl_file.put_raw(v_file,line_buf, TRUE);
    offset := offset+amount;
    --utl_file.fflush(v_file);
    --Dbms_Output.put_line(offset);
    END LOOP;
    utl_file.fclose(v_file);
    EXCEPTION
    WHEN OTHERS THEN
    UTL_FILE.FCLOSE_ALL;
    DBMS_OUTPUT.PUT_LINE('WHEN OTHERS');
    dbms_output.put_line(substr(sqlerrm,1,254));
    END;

    the database and blob fields are identical. In the 11i (eBusiness suite) we would store this information in fnd_lobs.
    Ike Wiggins
    http://bipublisher.blogspot.com

  • CRXIR2 image from blob field and some fonts not displaying in PDF export

    I used CRXIR2 developer edition to create a report linked to a SQL 2000 database table.  There is a blob field containing a JPG image that is different for each record in the table.  I am using VB.NET code with ASP.NET 2.0 to programmatically change the temp file to a local folder for easy cleanup, open this crystal report with the 11.5.3700.0 version of the assemblies, set the datasource to a DataTable extracted from the DB, and then export to a PDF file.
    The code for creating the PDF is:
            Dim TempRoot As String = MapPath(".") & "\temp\"
            Dim oldTmp As String = System.Environment.GetEnvironmentVariable("TMP")
            System.Environment.SetEnvironmentVariable("TMP", TempRoot)
            Dim objReport As New ReportDocument()
            objReport.Load(MapPath(".") & "\CReports\" & ReportName)
            For lnX As Integer = 0 To objReport.Database.Tables.Count - 1
                    objReport.Database.Tables(lnX).SetDataSource(resultTable)
            Next
            Dim objDestinationOptions As New DiskFileDestinationOptions()
            Dim objExportOptions As New ExportOptions()
            Dim objFormatTypeOptions As New CrystalDecisions.Shared.PdfRtfWordFormatOptions()
            Dim pdfName As String = "test.pdf"
            objDestinationOptions.DiskFileName = MapPath(".") & "\temp\" & pdfName
            objExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat
            objExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
            objExportOptions.ExportDestinationOptions = objDestinationOptions
            objReport.Export(objExportOptions)
            objReport.Dispose()
            System.Environment.SetEnvironmentVariable("TMP", oldTmp)
    When I run the site locally in VS2008, everything works fine and a PDF contains the graph and all the fonts are correct.
    However, when I run the exact same site from a web server running IIS6, the PDF generated does not have the image, and some of the fonts are substituted (all of the necessary fonts are installed on the IIS server).
    Please help!

    Hi Don,
    I am able to see the image and export from the CR Designer on my machine running XP.  However, I installed the designer on our IIS server running Server 2003, and the image does not show in the designer preview on that machine.
    I found another forum thread that you are involved in (1902383) that seems to be dealing with this exact issue, and it looks like there may not be a resolution.
    I am going to try a different route - instead of pulling in the SQL Image field directly, I am going to write it out to a temporary file and pull it in by altering the graphic location of the picture object in the report.
    I'll let you know how that works.
    Pete

  • Poor quality in images from blob field

    Post Author: pbrand
    CA Forum: .NET
    I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

    Post Author: pbrand
    CA Forum: .NET
    I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

  • Create packages from the SqlDeveloper 1.5 Extension API

    How do you CREATE and EXECUTE packages and procedures from the SqlDeveloper 1.5 Extension API?
    Not from the GUI... but from the Extension API.
    Any kind of package, for example...
    create or replace package MY_PKG is
    procedure my_procedure (a number, b number) ;
    end;
    create or replace package body MY_PKG is
    procedure my_procedure (a number, b number) is
    begin
    select 'x' from dual;
    end ;
    end;
    And then EXECUTE a package from the API...
    For example...
    exec MY_PKG.my_procedure (1, 2)

    Just use ordinary JDBC:
    Using the API, you can execute a query the following way:
    oracle.dbtools.db.DBUtil dbutil = oracle.dbtools.db.DBUtil.getInstance();
    dbutil.execute(oracleConnection, sql, binds);
    // There are various overloads and/or similar methods such as the following:
    String s = dbutil.executeReturnOneCol(oracleConnection, sql, binds);
    // (binds is a java.util.HashMap<String, Object>)
    It's interesting to note that you can turn on and off the notification of exceptions:
    dbutil.setRaiseError(false); //off
    dbutil.setRaiseError(true); //on
    Because of these methods, I was half expecting similar methods for executing PL/SQL.
    Apparently, there isn't any equivalent method for PL/SQL and you should just use ordinary JDBC instead.

  • Mitigating DRM creating packages from Steam games?

    In the light of recent events (http://www.reddit.com/r/Steam/comments/ … irst_game/), do you think it will be wise to create AUR packages from Steam games? These packages could be rebuilt everytime we want, considering that games can be updated.
    Before you said it, i know, this is our fault for accepting Steam with all its DRM crap included. That's why this is a mitigation, not a solution.
    Thanks!

    You have a naive undestanding of how steam and DRM works in general. (And possibly AUR, hard to tell)
    If a binary is locked to steam and valve says you can no longer play this game then you cannot start it even if you have all the files.
    In theory it could work in the so called "offline mode" for a while, but it will demand an internet connection sooner or later and then no game for you.
    Steam is DRM and they made it clear you are not buying the games, you just buy a license to play. If you want to create backups that will work don't buy steam games, use DRM free shops like the Humble Store or GOG.

  • Create PDF from text fields in website

    Hi!
    Is it possible to hook up text fields in a website to a PDF document?
    I have a website developed in Dreamweaver/asp and I would like the ability to create
    a PDF based on values from different text fields (10-12).
    Today we first insert the values to a webpage and then insert the same values to a PDF
    made in Live Cycle, I'm thinking there have to be a way to automate this process.
    Regards,
    Christian

    Hi Christian,
    I am moving this over to our form gurus in hopes they can assist you!
    Regards, Stacy

  • Create Package from /var/lib/pacman/local[SOLVED]

    I am trying to get an old version of google earth bcz the 5.2 in aur doesn't start for me.  I have it installed on another system but there is not package in /var/cache/pacman/pkg.  Is it possible for me to create a package based on the info written by pacman in /var/lib/pacman/loca/google-earth-x.xx.?
    Last edited by empthollow (2010-07-19 04:02:19)

    You need a PKGBUILD.
    Edit:
    Who would have thought that AUR packages write to /var/lib/pacman/local ? ;P
    I stand corrected: you don't necessarily need a PKGBUILD, you can use bacman.
    you can download the previous Google Earth binary from this link
    http://dl.google.com/earth/client/advan … hLinux.bin
    Last edited by karol (2010-07-19 03:59:29)

  • Creating links from report fields

    Hi,
    I have created a report but need to make one of the fields a hyperlink (ie 'LINK' field). The report is built from parameters entered by a user & so, every record returned will contain a different 'LINK' value. How can I specify that this needs to be displayed as a hyperlink? I've tried various ways to create the link by '<a href' tags in the report customization step but to no success.
    I cannot create a link component and attach it to the 'LINK' field as the value in this field changes each time depending on the entered parameters.
    Any assistance that can be provided is greatly appreciated!
    Thanks.

    You can use SQL report to do this:
    Suppose the column which contains the web addressed is called url_column, your SQL
    will be something like
    select htf.anchor(url_column, name) from the_table
    Then in the Column Formatting page,
    set the "Display as" for column url_column as HTML.
    Run the report and the values form that column will be a url which links to other web sites
    null

  • Creating count from queried fields

    Post Author: John
    CA Forum: Formula
    Hello all.  Newbie here to the forum and CR.
    Running CR 9
    I have a report that extracts certain data from the database.  A field that displays "test code", is not part of the original search criteria.  I have been asked to total "test code" but, I don't know how to count the records from the extracted data.
    For example,  I'm pulling in everyone with a last name that begins with a "J" and who came in the store from 01/01/07 - 01/31/07.  I then list the data and also print their address, city, state, zip, and "test code".  The "test code" is one of 3 possible codes.  I want to have 1 running total for each of these 3. 
    My knowledge allows me to create a running total on the field but, the total is from ALL of the records that match.
    So, if we had 45 people with "J" and 01/01/07 - 01/31/07, the running total will be 67 because it is finding all data sets that match it's code.  It isn't pulling from the original search criteria of "J" and 01/01/07 - 01/31/07.
    Any help is appreciated.
    John

    Post Author: yangster
    CA Forum: Formula
    A running total runs along side the data so it should never be placed in a header or the detail section.It must always reside in a group footer, page footer or report footer.Your basic running total in crystal will initilize at the report header, evaluate at the detail level and display the value in the report footer.So for your generalized case you have a simple running total that starts a count at 0 to start the report.You running total should be setup like thisField to summarize -> Product_IDType of summary -> countEvaluate - using formula -> inside formula typed in (if product_id = 4344211 then true else false)Reset -> neverAnd it won't matter if you put it in the GF2, GF1, PF, or RF the value will always be 4.  If your report spans multiple pages though you should not put the formula in the PF as it report the running total as of the page but keep on totaling to the next page.My suggestion to you would be to test your report with a manual running total to see exactly where your numbers counting is going astray.To do that create 3 formulas@init_count  (place in report header)whileprintingrecords;numbervar a;a:= 0@eval_count (place at the detail level)whileprintingrecords;numbervar a;if product = 4344211 thena := a + 1@display_count (place in the report footer)whileprintingrecords;numbervar a;athis will show you exactly what is being counted for every single item in your reportnormally you'd use a manual running total to get a summary of a summary or to sum a value at a group level but this should help you decode what is causing you buggy datahope this helps

  • Creating PDF from PowerPoint results in lines around images

    I've researched this topic on the forums and have seen some related posts but none that directly hit the issue I'm having. Have a PP file with some images and when I create PDF, the resulting file shows random "outline" lines partially around some of the images.  These lines do not show up when printing.  They go away if I uncheck the "Smooth Images" box under Edit/Preferences/Page Display.  However, unchecking the box degrades the image quality and requires the viewer to make this change in his version of Reader.  This PDF will be viewed typically on a screen rather than via print and I can't rely on the user to do the Smooth Images change.  I have spent lots of hours trying various potential fixes (differing file types, etc.) but can't figure it out and haven't been able to find a solution anywhere on the web.  Anyone up for the challenge of helping me figure it out?

    Any chance you can post a link to the file or PDF page?

  • Auto Create Filename from Form Fields

    Hello all,
    I am trying to find a way that I can save a form with a certain filename. I have the form create and all set to go. The user will be input some information into boxes. For instance I will have a Name box and a Date box. After the user is done filling out the form I would like the filename to be these two input boxes. Is there a way to do this? So basically I need to take these two form fields and have them be saved as the filename. Any help would be great. Thanks alot.

    You can export the data form the PDF using the FormDataIntegration service.
    Once you have the data in xml format, you can use a setValue and concatenate the value of the two nodes you're interested in.
    Jasmin

  • Reading the document from BLOB field in Forms10g

    I have stored a document (.DOC or .HTML) in BLOB fld in a table say Test1
    I want to read this document when I press button on a canvas.How to do this in forms10g. I have used webutil_file_transfer.DB_To_Client_with_progress.
    I can use same for downloading. But after downloading it should open the document aswell. how to go about this.

    Hello,
    <p>Read this.</p>
    Francois

Maybe you are looking for