Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: VBScript help

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,40495
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: VBScript help
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 2 3 [4]
Login
Message << Older Topic   Newer Topic >>
 RE: VBScript help - 12/13/2006 7:40:53 AM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Got my first rabbit punch after being so glad:

EdiComp-04.vbs should generate reports like this

    # Processing all files in Folder .\FolderA
    ==============================================================================
    = File test1.edi contains Link BR01_FACILITY_Numeric
    = File test2.edi contains Link BR05_FACILITY_Numeric
    = File test3.edi contains Link BR-A-3_FACILITY_Numeric
    ==============================================================================
    = 3 files processed, 3 Links found.

with code like this:

      reportStr "# Processing all files in Folder " + gsFolderA + vbCrLf + String( cnLiLen, "=" )
  a   For Each oFile In oFS.GetFolder( gsFolderA ).Files
          ...
      Next
      sRpt = "= @Files@ files processed, @Links@ Links found."
  b   sRpt = Replace( sRpt, "@Files@", CStr( oFS.GetFolder( gsFolderA ).Files.Count ) )
      sRpt = Replace( sRpt, "@Links@", CStr( dicLink.Count ) )
      reportStr String( cnLiLen, "=" ) + vbCrLf + sRpt + vbCrLf + String( cnLiLen, "#" )
      
but Ashok just sent me a report like this:

    # Processing all files in Folder .\FolderA
    ==============================================================================
    = File test1.edi contains Link BR01_FACILITY_Numeric
    = File test2.edi contains Link BR05_FACILITY_Numeric
    = File test3.edi contains Link BR-A-3_FACILITY_Numeric
    ==============================================================================
    = 4 files processed, 3 Links found.
     
Don't access volatile data more than once. The oFS.GetFolder( gsFolderA ) in
line a may well be different from the oFS.GetFolder( gsFolderA ) in line b.
The Count property may reflect files added (or deleted) between a and b.

Another bad example is using Now more than once, for example to build a
file name

   sFName = .. Year( Now ) ... Month( Now ) ...
  
And guess what: some times ago I chided someone for that.

The code (not tested) should be:

      reportStr "# Processing all files in Folder " + gsFolderA + vbCrLf + String( cnLiLen, "=" )
      Dim oFiles : Set oFiles = oFS.GetFolder( gsFolderA ).Files ' one and only access
  a   For Each oFile In oFiles
          ...
      Next
      sRpt = "= @Files@ files processed, @Links@ Links found."
  b   sRpt = Replace( sRpt, "@Files@", CStr( oFiles.Count ) )
 

< Message edited by ehvbs -- 12/13/2006 7:41:59 AM >

(in reply to ashok_ganeshs)
 
 
Post #: 61
 
 RE: VBScript help - 12/13/2006 7:47:57 AM   
  ashok_ganeshs

 

Posts: 92
Score: 0
Joined: 12/5/2006
Status: offline
Oooh oooh...I got it where the mistake was happen...

Actual Output from EHVBS

EdiComp-04.vbs should generate reports like this

    # Processing all files in Folder .\FolderA
    ==============================================================================
    = File test1.edi contains Link BR01_FACILITY_Numeric
    = File test2.edi contains Link BR05_FACILITY_Numeric
    = File test3.edi contains Link BR-A-3_FACILITY_Numeric
    ==============================================================================
    = 3 files processed, 3 Links found.


Ashok Output

but Ashok just sent me a report like this:

    # Processing all files in Folder .\FolderA
    ==============================================================================
    = File test1.edi contains Link BR01_FACILITY_Numeric
    = File test2.edi contains Link BR05_FACILITY_Numeric
    = File test3.edi contains Link BR-A-3_FACILITY_Numeric
    ==============================================================================
    = 4 files processed, 3 Links found.
     

actually folder A has 4 files but one file is a bad file that's why its skipped that file found 3 links...are you with me now ?
Thanks
Ashok

(in reply to ehvbs)
 
 
Post #: 62
 
 RE: VBScript help - 12/13/2006 7:53:35 AM   
  ehvbs

 

Posts: 2077
Score: 50
Joined: 6/22/2005
From: Germany
Status: offline
Hi Ashok,

regarding your  "what do you think after seing that result(i sent PM to you)"
and the report you posted:

The user documentation should contain:

   If duplicate Links are found in the files of the BizRule folder the script
   writes an appropriate message to the report file and exits immediately

Or

   If duplicate Links are found in the files of the BizRule folder the script
   will (without further notice) use the last file found containing such a Link
   to compare correspondig files in the Other folder

and - of course - the script should do exactly what's stated in the Docs.
  

(in reply to ehvbs)
 
 
Post #: 63
 
 RE: VBScript help - 12/13/2006 7:59:27 AM   
  ashok_ganeshs

 

Posts: 92
Score: 0
Joined: 12/5/2006
Status: offline
Hi Ehvbs,

Am lookin in to it...before get in to that part, again i have clear that issue why it shown 11 files processes ed   outof 12 files.

the 12th file is not a duplicate file its actual edi file but the format is wrong so basically the script consider as a badfile...that's why it didn't process that file...

Yes Edi files allow's space also.

Thanks
Ashok

(in reply to ehvbs)
 
 
Post #: 64
 
 RE: VBScript help - 1/10/2007 1:27:38 AM   
  ashok_ganeshs

 

Posts: 92
Score: 0
Joined: 12/5/2006
Status: offline
Hi Ehvbs and All,

After discussed lot of things with Ehvbs based on this script, the script is work fine.

Ehvbs advised me to do testing based on different scenario...

Condition 1:

If FolderA (BizRule) file contains unique link and floder B file contains duplicates

Result: Result as expected

Condition 2:

If FolderA (BizRule) file contains duplicate  link and floder B file contains duplicates

Result:It supress the duplicate link and give the incorrect information about the link details.

For example

Folder A contains 15 files and two duplicates .

then the result will be like this

==============================================================================
= 15 files processed, 13 Links found.


But Ehvbs advised me to abort the program if it found some duplicates in FolderA.

is this anything am missing here Ehvbs ?

Thanks
Ashok S Ganesh


(in reply to ashok_ganeshs)
 
 
Post #: 65
 
 
Page:  <<   < prev  1 2 3 [4]
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: VBScript help Page: <<   < prev  1 2 3 [4]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts