+ Reply to Thread
Results 1 to 21 of 21

Pull data from web within date range or recent date

  1. #1
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Pull data from web within date range or recent date

    Good day everyone. I have been using a macro to pull data regarding 3 seperate forms from a website table, and was needing help finding a way to find the document with the most recent date. Here is what the table looks like. on the website.

    http://www.pangaeadata.com/OCC_Files...api=3511922067

    Typically the order the forms go in are 1000,1001A,1002A. So a 1000 form is filed, and then a person will file a 1001A, and once completed they turn in a 1002A. This might happen for the same well numerous times. By the way this info pertains to oil and gas wells. The reason you have more than one is that someone might go back to an old well and recomplete it to see if they can pull more fluid/gas out of the ground. So when this happens a new cycle of forms starts. I would like to figure out how to only find the most recent document for each well in my list of urls like the one above. There are other forms on the website, but i am only concerned with the most recent one. Is there a way I would be able to do this easily? I set up my macro to search heirarchily, but i realized that the most recent document of either a 1000,1001A,or 1002A is all I really need. Any help would be much appreciated. Let me know if this makes sense to anyone or if you need more info from me. I posted the code I am using already below.


    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Hope someone can help out. Last thing I need to get this to work exactly how I want. Any help is much appreciated.

  3. #3
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    *bump* Could someone help to point me in the right direction?

  4. #4
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    *bump up the jam bump it up*

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    Is it the scan date or test date you're after? This is actually easier than the original query, since you aren't concerned about name, simply the date

  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    Assuming test date:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Thanks for replying. I just ran it and it seems to work fine, but if I wanted to only find the recent dates for the 1000, 1001A, and 1002A forms would that be fairly easy or pretty difficult. My boss kinda goes back and forth with what he wants so if I needed to change it to find the specific forms would I be able to incorporate the recent date script with the old script that searches for only the 1000, 1001A, 1002A forms?

  8. #8
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Thanks for replying. I just ran it and it seems to work fine, but if I wanted to only find the recent dates for the 1000, 1001A, and 1002A forms would that be fairly easy or pretty difficult. My boss kinda goes back and forth with what he wants so if I needed to change it to find the specific forms would I be able to incorporate the recent date script with the old script that searches for only the 1000, 1001A, 1002A forms?

  9. #9
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Just realized why you thought I was just looking for only the latest date of any file. I kinda mixed up my wording on what I needed. I was needing the latest testdate of only the 1000/1001A/1002A's. I can probably intergrate what you have done with the old code, but I won't be able to play around with it for a couple days. Ill get back to you with what I accomplish. Thanks again for the help. Ill leave this thread open til I actually get to testing out some stuff.

  10. #10
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Just realized why you thought I was just looking for only the latest date of any file. I kinda mixed up my wording on what I needed. I was needing the latest testdate of only the 1000/1001A/1002A's. I can probably intergrate what you have done with the old code, but I won't be able to play around with it for a couple days. Ill get back to you with what I accomplish. Thanks again for the help. Ill leave this thread open til I actually get to testing out some stuff.

  11. #11
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Would it be easiest to add the date into the three slookup areas from the previous code with the If CDate(oTable.Rows(x).Cells(6).innerText) > baseDate code? It seems simple enough but when I do that it doesnt reallly do anything. Just stops responding and crashes Excel. Kinda weird.

  12. #12
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Yeah. So i guess I dont know as much as I wish I did. Been messing with it for a few hours trying to merge the two together with not so much luck.

    Here is what i have so far:
    Please Login or Register  to view this content.
    Here is the Workbook. PERMITS_TO_COMPLETIONS_AUTOUP2.xlsm


    Trying to get it to the latest date in the same hierarchical order as before.

    Example: Find 1000 forms>Extract latest Date for 1000 form
    >Find 1001A if it exists>Overwrite 1000 date with 1001A latest date
    >Find 1002A if it exists>Overwrite 1001A date with 1002A latest date>Extract link to pdf download.

    I probably screwed the pooch on the code above. Learned this stuff pretty well 8 years ago, but just started using it again.

    ****Tried to delete the double posts but cant really find how to delete them. Not sure why its not just a button to delete, but yet again I may just be retarded.*****
    Last edited by Tlandress; 02-19-2013 at 10:37 PM.

  13. #13
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Should I start a new thread and mark this as solved. It is mostly want I wanted, and I will continue to try it out, but from my original post Kyle123 did actually solve what I initially asked. Let me know. Also, is there a donation link for this forum. Been really helpful in streamlining my workflow. Wanted to show some appreciation.

  14. #14
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    Hi,

    I'll have a look at it in the morning for you

  15. #15
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    Try this:
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Thanks man. Your code runs a whole lost faster than the last one I was using. Works great, but i it will only extract the data if it has more than one date. So if there is only one date for any of the forms it will just display a 0 for each array.

  17. #17
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    have you got a url with only one record?

  18. #18
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    Yeah. About a third of them have a single record for them. Went through to see why I was getting no return, and narrowed it down to it only having one instance of the record/date. So if only a single date is present it wont post. Which it seems to only apply to the 1000 form. Since it will have just the one date if its a completely new record.
    Not sure if these are helpful, but here are links:

    One record:
    http://www.pangaeadata.com/OCC_Files...api=3507124616

    More than one:
    http://www.pangaeadata.com/OCC_Files...api=3507124618
    Last edited by Tlandress; 02-21-2013 at 01:56 PM.

  19. #19
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    I need to read up on the basics apparently. I felt that I knew more, but I am not able to change your code to get it to work. It seems as though it would be easy to use the old one and incorporate parts of it into your code, but i am failing on getting it to work. Any good websites to give me a good run through of the ins and outs of writing these macros.

  20. #20
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Pull data from web within date range or recent date

    Not really that I know of - this one's pretty straightforward though. Set a break point in the function and step through with the locals window open and you should be able to follow it.

    Please Login or Register  to view this content.

  21. #21
    Registered User
    Join Date
    11-16-2012
    Location
    Oklahoma
    MS-Off Ver
    Excel 2003
    Posts
    31

    Re: Pull data from web within date range or recent date

    The code works really well, but runs into some problems when there are dates that are the same. I changed
    baseDate = CDate(oTable.Rows(2).Cells(6).innerText) to baseDate = 1 - CDate(oTable.Rows(2).Cells(6).innerText) and it seems to work for the ones that have forms with the same date. Only problem I am having right now is with one record that has 3 forms with all the same dates. The above code fixes the ones where there are a couple forms with the same date. If its an easy fix please let me know. If not I can deal with one not showing up properly out of the 1000 that I ran. You're awesome man. Helped me so much with this. Very much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1