Jump to content

SFDonovan

Members
  • Posts

    6
  • Joined

  • Last visited

SFDonovan's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. How do I sort? I'm not writing any query at all. Can you explain how I could "create a summary field that equals the max value of 'event_id' field"? The FileMaker database is not mine, but administered by another department and getting them to do anything is a long process.
  2. I have two separate applications with their own databases writing to the same grades layout in a FM database. I need to find the max event_id in the layout so I can increment back at the source. This will provide me with the event_id but will it give me the max event_id? //Create the 'find all' command and specify the layout $findCommand =& $fm->newFindAllCommand('Grades'); //Perform the find and store the result $result = $findCommand->execute(); //Check for an error if (FileMaker::isError($result)) { echo " Error: " . $result->getMessage() . ""; exit; } //Store the matching records $records = $result->getRecords(); //Retrieve and store the latest event_id in the grade layout $record = $records[0]; $event_id = $record->getField('event_id'); $event_id++;
  3. Well come to find out if I load the array each loop Then use the $newAdd->setField it works. Probably slower that dirt. while($row = $db->sql_fetchrow($pullgrades)) { $quiz_id = $row['quiz_id']; $quiz_name = $row['quiz_name']; $exam_type = $row['exam_type']; $course_number = $row['course_number']; $academic_year = $row['academic_year']; $uid = $row['uid']; $somkey = $row['somkey']; $username = $row['username']; $grade = $row['grade']; $arr_data = array('quiz_id' => $quiz_id, 'quiz_name' => $quiz_name, 'exam_type' => $exam_type, 'course_number' => $course_number, 'academic_year' => $academic_year, 'uid' => $uid, 'somkey' => $somkey, 'username' => $username, 'grade' => $grade); #### Add one at a time $newAdd = $fm->newAddCommand('Grades', $arr_data); $newAdd->setField('quiz_id', $quiz_id); $newAdd->setField('quiz_name', $quiz_name); $newAdd->setField('exam_type', $exam_type); $newAdd->setField('course_number', $course_number); $newAdd->setField('academic_year', $academic_year); $newAdd->setField('uid', $uid); $newAdd->setField('somkey', $somkey); $newAdd->setField('username', $username); $newAdd->setField('grade', $grade); $result = $newAdd->execute(); } Why it would not work with this array I don't know. $arr_data = array(); $i = 0; while($row = $db->sql_fetchrow($pullgrades)) { $arr_data[$i]['quiz_id'] = $row['quiz_id']; $arr_data[$i]['quiz_name'] = $row['quiz_name']; $arr_data[$i]['exam_type'] = $row['exam_type']; $arr_data[$i]['course_number'] = $row['course_number']; $arr_data[$i]['academic_year'] = $row['academic_year']; $arr_data[$i]['uid'] = $row['uid']; $arr_data[$i]['somkey'] = $row['somkey']; $arr_data[$i]['username'] = $row['username']; $arr_data[$i]['grade'] = $row['grade']; $i++; }
  4. It's fairly easy to do once you understand how. This took a long time after getting many of my questions answered by others more skilled than I. Here is my ajax example. It is for seeing students grades for either first or second year of medical school. First the form. echo "n"; echo " Course Grades & Peer Feedback"; echo ""; echo "Select a Year: "; echo "1"; echo "2 echo""; echo "Courses"; echo "Your result will display here"; echo""; echo""; echo""; Now the javascript. //we only do this once so we don't steal browser resources... //this is an updated function that will check for newer versions also... //move this to your header and anytime you need ajax just call it into a variable... var ajax = function() { var http; try { http = new XMLHttpRequest; ajax = function() { return new XMLHttpRequest; }; } catch(e) { var msxml = [ 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP' ]; for (var i=0, len = msxml.length; i < len; ++i) { try { http = new ActiveXObject(msxml[i]); ajax = function() { return new ActiveXObject(msxml[i]); }; break; } catch(e) { alert("Your browser does not support AJAX!"); } } } return http; }; //Browser Support Code //Show Courses function showCourses(el){ var ajaxRequest = ajax(); // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('course_data'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var year = el.value; var SOMS_KEY = document.getElementById('SOMS_KEY').value; var queryString = "ajax.php?op=listcourses&SOMS_KEY=" + SOMS_KEY + "&year=" + year; ajaxRequest.open("GET", queryString, true); ajaxRequest.send(null); } Notice the getElementById('course_data') is the same as the div tag in your form
  5. I wonder why this will not insert. $pullgrades = $db->sql_query("SELECT quiz_id, quiz_name, exam_type, course_number, academic_year, uid, somkey, username, grade FROM ".EXPORT_GRADE_TABLE." ORDER BY uid"); $arr_data = array(); $i = 0; while($row = $db->sql_fetchrow($pullgrades)) { $arr_data[$i]['quiz_id'] = $row['quiz_id']; $arr_data[$i]['quiz_name'] = $row['quiz_name']; $arr_data[$i]['exam_type'] = $row['exam_type']; $arr_data[$i]['course_number'] = $row['course_number']; $arr_data[$i]['academic_year'] = $row['academic_year']; $arr_data[$i]['uid'] = $row['uid']; $arr_data[$i]['somkey'] = $row['somkey']; $arr_data[$i]['username'] = $row['username']; $arr_data[$i]['grade'] = $row['grade']; $i++; } //echo" "; //print_r($arr_data); //echo""; //exit(); $newAdd = $fm->newAddCommand('Grades', $arr_data); $result = $newAdd->execute(); When I uncomment print_r I get... etc etc about 100 records. But my layout table is empty. Before I was doing this... But was only getting one record written to the layout so I made this change to loop into an array. $arr_data = array('quiz_id' => $quiz_id, 'quiz_name' => $quiz_name, 'exam_type' => $exam_type, 'course_number' => $course_number, 'academic_year' => $academic_year, 'uid' => $uid, 'somkey' => $somkey, 'username' => $username, 'grade' => $grade);
  6. I have exam grades stored in a MySQL server and want to insert these into a FileMaker table. I have made the connection and queried my records but am unsure just how to insert into FileMaker. I ran my query and now have everything in a while loop. while($row = $db->sql_fetchrow($pullgrades)) { $quiz_id = $row['quiz_id']; $quiz_name = $row['quiz_name']; $exam_type = $row['exam_type']; $course_number = $row['course_number']; $academic_year = $row['academic_year']; $uid = $row['uid']; $somkey = $row['somkey']; $username = $row['username']; $grade = $row['grade']; I have not found much documentation on what to do here. $request = $fm->newAddCommand('addGrades'); Do I use something like... $request->setField(something, $something); $request->execute();
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.