CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 ccs (latest) visual fox 6.0 date format problem

Print topic Send  topic

Author Message
Donald McDonald
Posted: 01/14/2004, 2:51 AM

has anyone successfully set the date format for visual fox pro 6.0.

would you be willing to share that information with me?

have to develope a web application using visual fox 6.0. Clients inhouse system is visual fox 6.0.....

everything seems to work fine except the date format.

Help
Don
lvalverdeb

Posts: 299
Posted: 01/14/2004, 10:54 AM

Donald,

What type are the foxpro date fields? Datetime or date? As I understand it in CCS the DBFormat property must match that one in the database. I believe, Foxpro's format is YYYY-MM-DD.

Luis

_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
Donald
Posted: 01/14/2004, 7:35 PM

in foxpro i only used the date format, not datetime. so i format for 'yyyy-mm-dd' and it blows up with a datatype mismatch. the common.php handels the date as an array and i don't understand how it figures to insert an array into a date field.

thanks for the reply,
don
lvalverdeb

Posts: 299
Posted: 01/16/2004, 6:42 AM

Donald,

Maybe you'd accept a workaround as a solution. The ODBC error appears to be triggered by the fact that CCS exports the date as a string whilst foxpro expects a {^yyyy-mm-dd}. The following code in the BeforeExecuteUpdate and the BeforeExecuteInsert seems to do the trick. It replaces the portion of the SQL statement that exports the date field and fixes this with the correct syntax (I hope).

global $rgv_clientes; // your forms where
$oldSQL = $rgv_clientes->ds->SQL; // originally generated SQL statement
$dateField = $rgv_clientes->cliente_desde; // date field
$fieldToFind = $dateField->Name; // name of date field
$lengthDate = 20; // length of the date value i.e. a string like '2002-12-01 00:00:00'
$fieldStrLen = strlen($fieldToFind); // length of name of the date field
$miPos = strpos($oldSQL,$fieldToFind); // start position of the date field withing the SQL statement
if ($miPos === false)
echo "no encontrado";
$firstQuote = ($miPos+$fieldStrLen+1); //position of the first single quote i.e end of field + position of the = sign
$strToReplace = $fieldToFind."=".substr($oldSQL,$firstQuote,$lengthDate+1); //
$strToUse = $fieldToFind."="."{^".substr($oldSQL,$firstQuote+1,$lengthDate-1)."}";//
$startPos = strpos($oldSQL,$strToReplace);
$newSQL = substr_replace($oldSQL,$strToUse,$startPos,strlen($strToUse));
$rgv_clientes->ds->SQL = $newSQL; // revised SQL Statement for VFP.

_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
lvalverdeb

Posts: 299
Posted: 01/16/2004, 1:28 PM

Donald,

Same thing as function.

Regards

Luis

function SQLToFox($sql,$myform,$myfield)
{
if (strlen($sql))
{
$newSQL = "";
$FieldName = $myfield->Name;
$DataType = $myfield->DataType;
$FieldPos = strpos($sql,$FieldName);
if ($FieldPos !== false)
{
switch ($DataType)
{
case ccsDate:
$FieldLength = 20;
$firstQuote = ($FieldPos+strlen($FieldName)+1); //position of the first single quote i.e end of field + position of the = sign
$strToReplace = $FieldName."=".substr($sql,$firstQuote,$FieldLength+1); //
$strToUse = $FieldName."={^".substr($sql,$firstQuote+1,$FieldLength-1)."}";//
$startPos = strpos($sql,$strToReplace);
$newSQL = substr_replace($sql,$strToUse,$startPos,strlen($strToUse));
return $newSQL;
break;
case ccsBoolean:
//There may be other data types in VFP
//$FieldLength = 1;
break;
default :
return $sql;
}
}
else
{
return $sql;
}
}
}
_________________
lvalverdeb
CR, GMT-6
XAMPP/Ubuntu/CCS3.2/4
View profile  Send private message
Donald
Posted: 01/16/2004, 9:36 PM

Thank you very much for your kind response.

I am working on it right now. It may take a bit to understand your level of expertise, but I will. Thanks again.

Donald
jhoana tan
Posted: 03/31/2004, 10:24 PM

Good Afternoon, Im just asking if you have any kind of machine problems on FOX PRO/DATABASE? if its ok i would like to have machine problems because we hava a project about it. to submit many machine problems about FOX PRO/ DATABASE as possible.
Im hoping for your kind respose. Jhoana Abuan
Alsaad Ishaq
Posted: 04/23/2004, 9:26 AM

:( I havve a problem with Visual fox Pro data files. One of the files is showing as it is not a table . can I retrive the information

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.