How to count files in a folder and subfolders of the folder.

Hello everyone,
I'm having a difficulty with countin files in a Regular folder and subfolders of the folder. I've tried to use SI_ANCESTOR  in a query; however, it gives me innacurate results.
I used this hierarchy to create the code below, and it works to count all the files:
Folder A ---> Folder B( subFolder of A)  -
> Folder C(subFolder of B)  
//get folder A
IInfoObjects regFolders = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND='Folder' AND SI_PARENTID=0 AND SI_NAME!='User Folders' Order by SI_NAME");
IFolder regFolder = (IFolder) regFolders.get(0);     
//get files from Folder A     
IInfoObjects rFiles = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID !   = 'CrystalEnterprise.Folder'   AND SI_PARENTID=" + regFolder.getID() );
ilesCount += rFiles.size();
int subCntr=0;
nt subCntr2=0;
  //get folder B      
IInfoObjects rSubFolders = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Folder' AND SI_PARENTID=" + regFolder.getID() );
//get files from subFolders of Folder A
while (subCntr < rSubFolders.size())
          IInfoObject subFolder=(IInfoObject)rSubFolders.get(subCntr);
          IInfoObjects subFiles = infoStore.query ("SELECT * FROM CI_INFOOBJECTS "
      + " WHERE SI_PROGID != 'CrystalEnterprise.Folder'" AND SI_PARENTID=" + subFolder.getID() );
         filesCount += subFiles.size();
         //get subFolders of Folder B                   
         IInfoObjects rSubFolders2 = infoStore.query ("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.Folder' AND SI_PARENTID=" + subFolder.getID() );
                     //get files from subFolders of Folder B
     while (subCntr2 < rSubFolders2.size())
          IInfoObject subFolder2=(IInfoObject)rSubFolders2.get(subCntr2);
          IInfoObjects subFiles2 = infoStore.query ("SELECT * FROM CI_INFOOBJECTS "
               + " WHERE SI_PROGID != 'CrystalEnterprise.Folder'  AND SI_PARENTID=" + subFolder2.getID() );
                                           filesCount += subFiles2.size();
           subCntr2++;
          subCntr++;
As you can see, the code is too complicated, and what if folder C has subFolder?
I'm guessin maybe recursion would be one way to got, but I'm not really good with it, so I was wondering if anyone has any idea on how to go about doing it.
Thank you,

Hi,
For detailed information, please refer to the BI 4.0 developers guide here.
You can find the section "Setting up the development environment" in developers guide that have every single instruction to execute a java code specific to BI 4.0 environment.
Also, here are the instructions for BO 3.1 environment:
To configure a WAR file for a J2EE application that uses the BusinessObjects Enterprise XI 3.0 and 3.1 Java SDK, complete these steps:
Create a lib folder in the WAR file's WEB-INF folder.
Copy the Enterprise XI 3.0 or 3.1 Java SDK JAR files from the appropriate location below to the WAR file's WEB-INF\lib folder:
Windows:
...\Program Files\Business Objects\common\4.0\java\lib
UNIX:
<businessobjects_root>/java/lib
Copy the log4j.jar file from the appropriate location below to the WAR file's WEB-INF\lib folder:
Windows:
...\Program Files\Business Objects\common\4.0\java\lib\external
UNIX:
<businessobjects_root>/java/lib/external
Copy the entire crystalreportviewers12 folder from the appropriate location below to the WAR file's root folder.
Windows:
...\Program Files\Business Objects\common\4.0
UNIX:
<businessobjects_root>/enterprise12/JavaSDK
Open the web.xml file located in the WAR file's WEB-INF folder.
Specify the location of the utility files used by the report viewers contained in the crystalreportviewers12 folder by inserting the following code below the <display-name> and <description> tags but within the <webapp> tag definition:
<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>/BOXIR3/crystalreportviewers12</param-value>
</context-param>
<servlet>
<servlet-name>CrystalReportViewerServlet</servlet-name>
<servlet-class>com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CrystalReportViewerServlet</servlet-name>
<url-pattern>/CrystalReportViewerHandler</url-pattern>
</servlet-mapping>
Deploy the WAR file to the J2EE application server.
You are now able to run an application using the BusinessObjects Enterprise XI 3.0 and 3.1 Java SDK on a J2EE web application server.
Hope it helps.
Regards,
Anchal

Similar Messages

  • The clicks are so sensitive, that it is registering 2 clicks when I press once. I close a bookmark folder, and it opens the folder that should be under the mouse pointer!

    I cant write it any more clear, it processes two clicks as one!
    At first I didnt really mind, but I'm here now. It's having a drip drip effect, and when your working that can boil the blood! Even made me consider loading back up IE! And thats something!

    Sounds like a faulty mouse.

  • How can i open the directory/​folder and read all the files inside it in order and then close it?

    How can i open the directory/folder and read all the files inside it in order and then close it? any example would be nice.
    thanks

    In the File I/O>>Advanced File Functions Palette is a function named "List directory". This function will give you two arrays. One contains the names of all subdirectories the other the names of all files. If you want to sort them by name use the array sort function. If you want to sort them by another attribute use the File/Directory Info function to get more data. Use a cluster which contains the attribut to sort and the original index of the name. Then sort this array.
    Waldemar
    Waldemar
    Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
    Don't forget to give Kudos to good answers and/or questions

  • Concern with "File Sharing: On" -- my root user folder (and subfolders) and Macintosh HD is visible

    Hi all,
    When I set up a File Sharing folder in OSX called "Share", I connected from my PC to my Macbook Pro and not only did I see the "Share" folder but I also could see and have total access to my root user folder (all its subfolders too) and my Macintosh HD (hard disk).  Did I miss something?  All I did was check mark "File Sharing" in the Sharing option of System Preferences.  Then I specifically shared only the "Share" folder that I created on the OSX desktop.
    How do I turn of sharing for the root user folder and my Macintosh HD folder?
    Many thanks in advance!

    Yes, I was logging in from my PC laptop to Mac as the Admin.  However, since there is a User called "Everyone" and I, for testing purposes only, turned Read/Write on for "Everyone", I figured I did not have to set up another user (such as "Guest").  I was wrong.  Once I created a new user called "Guest" and specifically checked the Guest account in the SMB option, it worked in the restricted mode I was hoping for.  Thanks!

  • I'm trying to copy music from my PC to itunes. I open itunes, go to 'file', go to 'add folder to library', select the folder and nothing happens. What am I doing wrong?

    I'm trying to copy music from my PC to itunes. I open itunes, go to 'file', go to 'add folder to library', select the folder and nothing happens. What am I doing wrong?

    Hello there, gleab.
    The following Knowledge Base article reviews the ways to import content into iTunes:
    Adding music and other content to iTunes
    http://support.apple.com/kb/ht1473
    Also keep in mind which formats can be added:
    You can add audio files that are in AAC, MP3, WAV, AIFF, Apple Lossless, or Audible.com (.aa) format. If you have unprotected WMA content, iTunes for Windows can convert these files to one of these formats.
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • When i look at how much hard drive space i have available, my mac says i have 250 gigs used up in backup.  I can not find this backup file to delete it and free up the space

    When i look at how much hard drive space i have available, my mac says i have 250 gigs used up in backup.  I can not find this backup file to delete it and free up the space

    OmniDiskSweeper is a free utility that checks HD space.
    FreeSpace cost $1 or is a free utility that checks HD space.
    SpaceControl is a free utility that checks HD space.

  • How to count Sent SMS in E63 and other E series No...

    Hi... 
    How to count Sent SMS in E63 and other E series Nokia phone
    I tried some software but they are not made for E63 or else its need to purchase.
    Expecting solution. 

    In Menu-> log you can filter your messages for counting. You can export the log to e.g. Excel on PC with LogExport.
    http://tinyhack.com/freewarelist/s603rd/2007/03/02/logexport/
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • I transferred data from my Macbook Pro to my Mac mini but it forced me to make a new user for my old data.  How do I transfer my music, pics, and docs from the "old" user to the new user (so that I only have one user instead of 2?)

    I transferred data from my Macbook Pro to my Mac mini but it forced me to make a new user for my old data.  How do I transfer my music, pics, and docs from the "old" user to the new user (so that I only have one user instead of 2?)

    Unless you transfer the files from Setup Assistant, Migration Assistant creates a new user with the data.
    To transfer the files to your first user, you have to log on this new user, and copy all your files to /Users/Shard folder. This is a folder where you can put the files you want to share between two or more users, and all users can read and write in it.
    After copying the files, go to your first user, open /Users/Shared folder, and copy the files to your user folders. If you migrated applications, you must know that they are stored in a common folder (/Applications), so you don't have to transfer them. To open /Users/Shared folder, open Go menu (in the menu bar) > Go to Folder, and type the folder

  • Need To Get Folder and Subfolders List

    Hi All
    I have a requirement which will give me the list of folder and subfolders list for a given path. I can achieve this using xp_cmdshell.
    But it is admin level usage. So i need to get with the use SP_OAMethod using file system object.
    Please help me to do the same.

    Hello Amarnath, Finally i have the code that you are looking for. 
    SELECT * FROM dbo.dir('c:\testfolder') WHERE IsFolder =1
    --------------- USER DEFINE FUNCTION
    CREATE FUNCTION [dbo].[Dir](@Wildcard VARCHAR(8000))
    RETURNS @MyDir TABLE
    -- columns returned by the function
    [name] VARCHAR(2000), --the name of the filesystem object
    [path] VARCHAR(2000), --Contains the item's full path and name.
    [ModifyDate] DATETIME, --the time it was last modified
    [IsFileSystem] INT, --1 if it is part of the file system
    [IsFolder] INT, --1 if it is a folsdder otherwise 0
    [error] VARCHAR(2000) --if an error occured, gives the error otherwise null
    AS
    -- body of the function
    BEGIN
    DECLARE
    --all the objects used
    @objShellApplication INT,
    @objFolder INT,
    @objItem INT,
    @objErrorObject INT,
    @objFolderItems INT,
    --potential error message shows where error occurred.
    @strErrorMessage VARCHAR(1000),
    --command sent to OLE automation
    @Command VARCHAR(1000),
    @hr INT, --OLE result (0 if OK)
    @count INT,@ii INT,
    @name VARCHAR(2000),--the name of the current item
    @path VARCHAR(2000),--the path of the current item
    @ModifyDate DATETIME,--the date the current item last modified
    @IsFileSystem INT, --1 if the current item is part of the file system
    @IsFolder INT --1 if the current item is a file
    IF LEN(COALESCE(@Wildcard,''))<2
    RETURN
    SELECT @strErrorMessage = 'opening the Shell Application Object'
    EXECUTE @hr = sp_OACreate 'Shell.Application',
    @objShellApplication OUT
    --now we get the folder.
    IF @HR = 0
    SELECT @objErrorObject = @objShellApplication,
    @strErrorMessage = 'Getting Folder"' + @wildcard + '"',
    @command = 'NameSpace("'+@wildcard+'")'
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objShellApplication, @command,
    @objFolder OUT
    IF @objFolder IS NULL RETURN --nothing there. Sod the error message
    --and then the number of objects in the folder
    SELECT @objErrorObject = @objFolder,
    @strErrorMessage = 'Getting count of Folder items in "' + @wildcard + '"',
    @command = 'Items.Count'
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objfolder, @command,
    @count OUT
    IF @HR = 0 --now get the FolderItems collection
    SELECT @objErrorObject = @objFolder,
    @strErrorMessage = ' getting folderitems',
    @command='items()'
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objFolder,
    @command, @objFolderItems OUTPUT
    SELECT @ii = 0
    WHILE @hr = 0 AND @ii< @count --iterate through the FolderItems collection
    BEGIN
    IF @HR = 0
    SELECT @objErrorObject = @objFolderItems,
    @strErrorMessage = ' getting folder item '
    + CAST(@ii AS VARCHAR(5)),
    @command='item(' + CAST(@ii AS VARCHAR(5))+')'
    --@Command='GetDetailsOf('+ cast(@ii as varchar(5))+',1)'
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objFolderItems,
    @command, @objItem OUTPUT
    IF @HR = 0
    SELECT @objErrorObject = @objItem,
    @strErrorMessage = ' getting folder item properties'
    + CAST(@ii AS VARCHAR(5))
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objItem,
    'path', @path OUTPUT
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objItem,
    'name', @name OUTPUT
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objItem,
    'ModifyDate', @ModifyDate OUTPUT
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objItem,
    'IsFileSystem', @IsFileSystem OUTPUT
    IF @HR = 0
    EXECUTE @hr = sp_OAMethod @objItem,
    'IsFolder', @IsFolder OUTPUT
    --and insert the properties into a table
    INSERT INTO @MyDir ([NAME], [path], ModifyDate, IsFileSystem, IsFolder)
    SELECT @NAME, @path, @ModifyDate, @IsFileSystem, @IsFolder
    IF @HR = 0 EXECUTE sp_OADestroy @objItem
    SELECT @ii=@ii+1
    END
    IF @hr <> 0
    BEGIN
    DECLARE @Source VARCHAR(255),
    @Description VARCHAR(255),
    @Helpfile VARCHAR(255),
    @HelpID INT
    EXECUTE sp_OAGetErrorInfo @objErrorObject, @source OUTPUT,
    @Description OUTPUT, @Helpfile OUTPUT, @HelpID OUTPUT
    SELECT @strErrorMessage = 'Error whilst '
    + COALESCE(@strErrorMessage, 'doing something') + ', '
    + COALESCE(@Description, '')
    INSERT INTO @MyDir(error) SELECT LEFT(@strErrorMessage,2000)
    END
    EXECUTE sp_OADestroy @objFolder
    EXECUTE sp_OADestroy @objShellApplication
    RETURN
    END---- OUTPUT
    Regards, RSingh

  • A magazine's app on my iPad has stopped working.  When I open the Newsstand folder and click on the app, the screen dims briefly, then returns to the Newsstand folder. The other app in my Newsstand folder (Wall Street Journal) opens without any problem.

    A magazine's app on my iPad has stopped working.  When I open the Newsstand folder and click on the app, the screen dims briefly, then returns to the Newsstand folder. The other app in my Newsstand folder (Wall Street Journal) opens without any problem, and this magazine's app opens just fine on my wife's iPad.
    I have deleted the app and reinstalled it from the Apple store and that makes no difference.  I have also done a hard reboot on my iPad with no result.
    Any thoughts about what might be wrong? 

    Hey everyone in Apple world!
    I figured out how to fix the flashing yellow screen problem that I've been having on my MBP!  Yessssss!!!
    I found this super handy website with the golden answer: http://support.apple.com/kb/HT1379
    I followed the instructions on this page and here's what I did:
    Resetting NVRAM / PRAM
    Shut down your Mac.
    Locate the following keys on the keyboard: Command (⌘), Option, P, and R. You will need to hold these keys down simultaneously in step 4.
    Turn on the computer.
    Press and hold the Command-Option-P-R keys before the gray screen appears.
    Hold the keys down until the computer restarts and you hear the startup sound for the second time.
    Release the keys.
    I went through the 6 steps above twice, just to make sure I got rid of whatever stuff was holding up my bootup process.  Since I did that, my MBP boots up just like normal.  No flashing yellow screen anymore!!   
    (Note that I arrived at this solution when I first saw this page: http://support.apple.com/kb/TS2570?viewlocale=en_US)
    Let me know if this works for you!
    Elaine

  • My folders take forever to open and then the docs within take a long time for the icon to pop up. the same thing with moving itmes from the desktop to a folder, and also emptying the trashh

    my folders take forever to open and then the docs within take a long time for the icon to pop up. the same thing with moving itmes from the desktop to a folder, and also emptying the trashh

    Don't know if that would be a failing hard drive, but it may be that you are out of available space. How much hard drive space do you have available? Please highlight the Macintosh HD icon and then press Command and I for a get info window. Once open, please copy and post the following:
    Capacity:
    Used:
    Available:
    Mac OS requires a minimum of 10 - 15% of total hard drive space available and empty at all times in order to operate properly.

  • Aperture does not recognize that there are images to be imported on an SD card. My workaround is to copy the images from the ST card to a folder and then import the images from the folder. Aperture also imports incredibly slowly after the update to 3.4

    Aperture does not recognize that there are images to be imported on an SD card. My workaround is to copy the images from the SD card to a folder and then import the images from the folder. Aperture also imports incredibly slowly after the update to 3.4

    Check your Import settings in the Import Panel, i.e. all that might exclude the image type you want to import:
    If you did not exclude any file types, and still Aperture will not import, remove your ImageCapture preferences fro your user library:
    To remove the image capture preferences:
    If Aperture is running, quit Aperture,  and log off and on again.
    Open your user library from the Finder's Go menu: Hit Command Shift G (⌘⇧G) and then type in: ~/Library/Preferences/  then hit return.
    In the window that opens remove "com.apple.ImageCapture.plist"
    and look into the subfolder "ByHost": if there are files named com.apple.ImageCapture  something .plist  remove them too.
    then try again.
    And if that still does not help, remove the Aperture preferences as well:
    ~/Library/Preferences/aperture.plist
    Regards
    Léonie
    P.S. in MacOS Lion and later the user library ~/Library is hidden by default.
    You can reveal it also  from the Finder's "Go" menu:
    Finder > Go,   then hold down the options ⌥ key, until the Library appears in the drop-down menu, select it and open the Library folder. Then go to the "Preferences".

  • I'm a Pro Tools user, who just did an "Archive and Install" installation of 10.5.8 over my 10.4.11 on my 2 Ghz G5, now Pro Tools won't launch.  I checked the extensions folder and sure enough, the digidesign extensions were left behind.  Can I revert back

    I'm a Pro Tools user, who just did an "Archive and Install" installation of 10.5.8 over my 10.4.11 on my 2 Ghz G5, now Pro Tools won't launch.  I checked the extensions folder and sure enough, the digidesign extensions were left behind.  Can I revert back to the "Archive" of my 10.4.11 System from the "Previous Systems" folder?  If not, what's the point of creating the "archive"?

    Did you select "Preserve User Settings"?
    Archive and Install installation automatically moves existing system files to a folder named Previous System, then installs Mac OS X again. (See tip 3.) You cannot start up your computer using a Previous System folder, nor can you "re-bless" the Previous System folder. (See tip 1.)
    You can choose to preserve your user and network settings before installing. This option automatically moves existing users, Home directories, and network settings. This also skips the Setup Assistant after installation.
    Note: Because the "Preserve user and network settings" option moves, not copies, existing users, Home directories, and network settings, from the Previous Systems folder to the newly installed System, these items will not exist in the Previous Systems folder after the Archive and Install is complete.
    http://support.apple.com/kb/ht1710
    Read this:
    http://support.apple.com/kb/HT2196
    BTW, it is never recommended to do a major OS change without having a full, bootable backup.

  • I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.

    I am not aware of a way except for photos that allows you to select multiple files in an email. I even checked settings in the Adobe Reader app, and it does not show that ability.

  • HT201269 Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account

    Hi. I have shared an Apple ID with my children for some time.  As they are getting older they do not wnat me seeing all their messages, photos etc so want their own accounts.  How can they access their purchased music and apps on the new account please?

    Yes.
    On their iOS devices, under Settings>iTunes & App Store, they should use your Apple ID. When they log into iCloud, iMessage and Facetime, they should use their personal Apple IDs.

Maybe you are looking for