Solved

Read dates from excel file

Posted on 2004-09-06
4
179 Views
Last Modified: 2010-04-06
Hi experts,

I have an excel file of the form:
              ColA                ColB         ColC       ........       ColK          Col L      .........................
Row4      Name            Position       Location             Start Date     Appraisal date
Row5    Person1        Manager        Location1            01/Aug/04      01/Oct/04
Row6    Person2        Nurse            Location2             08/Aug/04      08/Oct/04

I'm writing a simple html page where the locations will be in a drop down menu, and another menu will contain the 12 months of the year.
What i need is for the user to pick the location and/or month, and what is returned (in any way) is the details of people with the appraisals due in that period.

Thanks,
Glen
0
Comment
Question by:Glenhomes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:sgalzin
ID: 11989261
hi,

at first sight, i'd suggest you enter all the information in a javascript array. the way you'd go about that is :

*** begin file test.html ***
<html><head><script language="JavaScript"><!--

var data = new Array ();

data [ 0 ] = new Array ( 'Person1', 'Manager', 'Location1', /* etc. */ '01/Aug/04', '01/Oct/04' /* etc. */ );
data [ 1 ] = new Array ( 'Person2', 'Nurse', 'Location2', /* etc. */ '08/Aug/04', '08/Oct/04' /* etc. */ );
// and continue with data [ 2 ], data [ 3 ], etc.

//--></script></head><body>
<!-- the rest of your html code -->
</body></html>
*** end file test.html ***

then, please show us your html code so that we can link it with the javascript in order for it to do what you want.

please note : if you have too much of this information to enter by hand, we could probably write a small excel formula to help you type it, such as this one you could put in cell M5 :

="data [ " & ( ROW($A5) - 5 ) & " ] = new Array ( '" & A5 & "', '" & B5 & "', '" & C5 & "', '" & D5 & "', '" & E5 & "', '" & F5 & "', '" & G5 & "', '" & H5 & "', '" & I5 & "', '" & J5 & "', '" & K5 & "', '" & L5 & "' );"

then all you'd have to do is copy and paste the result in notepad.

cheers,

stephane.
0
 
LVL 4

Accepted Solution

by:
sgalzin earned 500 total points
ID: 11990182
hi,

here's a new file that integrates a little of the html necessary. this is a working script (at least on my computer ;-). i hope this helps,

stephane.

*** begin file test.html ***
<html><head><script language="JavaScript"><!--

function getMonthNumber ( name )
{
 alert ( name );
 return '08';
}

function goSearch ()
{
 var s = '<table border="1"><tr><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td><td>F</td><td>G</td><td>H</td><td>I</td><td>J</td><td>K</td><td>L</td>';
 for ( var i = 0 ; i < data.length; i ++ )
 {
  var min = ( new Date ( Date.parse ( data [ i ] [ 10 ] .replace ( /(\d\d)\/([A-Z][a-z][a-z])\/(\d\d)/gi, '$2 $1, 20$3' ) ) ) ).getMonth () +1;
  var max = ( new Date ( Date.parse ( data [ i ] [ 11 ] .replace ( /(\d\d)\/([A-Z][a-z][a-z])\/(\d\d)/gi, '$2 $1, 20$3' ) ) ) ).getMonth () +1;
  if ( ( ( document.getElementById ( 'location' ).value == 0 ) || ( document.getElementById ( 'location' ).value == data [ i ] [ 2 ] ) ) && ( ( document.getElementById ( 'month' ).value == 0 ) || ( ( document.getElementById ( 'month' ).value >= min ) && ( document.getElementById ( 'month' ).value <= max ) ) ) )
  {
   s += '<tr>';
   for ( var j = 0; j < data [i ].length; j ++ )
    s += '<td>' + ( data [ i ] [ j ] == '' ? '&nbsp;' : data [ i ] [ j ] ) + '</td>';
   s += '</tr>';
  }
 }
 searchResults.innerHTML = s + '</table>';
}

var data = new Array ();

data [ 0 ] = new Array ( 'Person1', 'Manager', 'Location1', '', '', '', '', '', '', '', '01/Aug/04', '01/Oct/04' );
data [ 1 ] = new Array ( 'Person2', 'Nurse', 'Location2', '', '', '', '', '', '', '', '08/Aug/04', '08/Oct/04' );
// and continue with data [ 2 ], data [ 3 ], etc.

//--></script></head><body>

<select id="location">
<option value="0" selected>Select a location
<option value="Location1">Location1
<option value="Location2">Location2
<option value="Location3">Location3
</select>
&nbsp;&nbsp;
<select id="month">
<option value="0" selected>Select a month
<option value="1">January
<option value="2">February
<option value="3">March
<option value="4">April
<option value="5">May
<option value="6">June
<option value="7">July
<option value="8">August
<option value="9">September
<option value="10">October
<option value="11">November
<option value="12">December
</select>
&nbsp;&nbsp;<input type="button" onclick="goSearch()" value="Go Search !">
<div id="searchResults"></div>
</body></html>
*** end file test.html ***
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML Video won't Autoplay on site 6 43
Forbidden errors 5 158
Tool to email me when a website changes 29 147
MediaWiki - Move a site 4 56
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question