Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
Don't ask to ask, just ask
 
PerlMonks  

Re: Excel Reports thru CGI

by cbro (Pilgrim)
on Aug 21, 2003 at 14:14 UTC ( #285475=note: print w/ replies, xml ) Need Help??


in reply to Excel Reports thru CGI

To give you an exact answer, I think a little more specifics on what matching criteria you are going to allow is necessary. (e.g. you say that the user can enter 3 as the year. Does that mean that the only number the user can enter for the year, other then the exact year string, is the number that the year ends in? Or, can they enter '2' because that is also a number in the year 2003).
But, at least to get you started...
1. Read in your users' entries via the param() method.
2. Split your date (which is what I think may be your main concern) like this: my ($month, $day, $year) = split(/\-|\//, $date); Where $date is your Excel spreadsheet date.
3. Finally, and this is where I would need some more specifics, do a regex to match the users data to your split $date. Just an example:

if ($month =~ /$user_month/ || $day =~ /$user_day/ || $year =~ /$user_year$/) { # The regex says: if the excel month contains the # user's entry for month, or the day contains the # user's entry for the day, or the year ends in the # the number that the user entered for year, then # go ahead and count that as a match. Unless you # give the exact criteria, I can't come up w/the # regex. There are a million possibilities. This one # ,for example, would NOT match if the user didn't # enter a month or day, but entered the exact year. # Which is probably not what you want. It would also # match too many things. (e.g. if the user entered '1' # for month, it would match 10, 11, 12, 01, etc.). # Let me know the criteria, and I can come up with the # correct regex. }


Comment on Re: Excel Reports thru CGI
Select or Download Code
Re: Re: Excel Reports thru CGI
by rupesh (Hermit) on Aug 22, 2003 at 05:52 UTC
    The search criteria would be:
    2 digits for month, 2 digits for day and 4 digits for year
    Your suggestions of filtering results even more further will be helpful.
    Thanks!

    Did you ever notice that when you blow in a dog's face, it gets mad at you but when you take him on a car ride,he sticks his head out the window and likes it?
      Sorry about the delay. I took Friday and Monday off (and was already gone by the time you responded). I DO NOT touch computers when I take vacations. I 'msg' you on CB in case you don't read this.
      I need the match criteria. That is, what will you allow the user to enter in order to consider his or her data to match against a date listing in your spread sheet. Here are just some questions to give you an idea of what I'm trying to get at.

      The user can enter one digit to match the year, according to your OP. So, if they don't enter the exact year, must that one digit be the last digit of the year? Or if they enter '03' should that match 2003? Or if they enter '2', should that match 2003 (because it's the first digit of the year) or only 2002? What about 20? etc....

      You said they can enter '8' for the month to match August. What if they enter '1'? Should that only match January? Or, should it match '11', '12', '10'?
      This is what I need to know to come up with the regex.
      I have a feeling when you go through and make all of those decisions...you'll be able to come up with the regex yourself :o).

      As far as filtering...I'll answer that when you either tell me that you have the regexes, or when I attempt to help you with them.

      Thanks,
      Chris

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://285475]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-04-24 11:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (565 votes), past polls