|
Android App: Records being submitted with wrong month abbreviations? |
Débuté par Claire, 04 avr. 2018 19:24 - 12 réponses |
| |
| | | |
|
| |
Posté le 04 avril 2018 - 19:24 |
Could anyone explain this to me? In the project description, the Language is set to English and because of a problem we had with our iOS version, we had to "hardcode" the date to "Use the Following Parameters" DD-MMM-YYYY and when you click "Days and Months" all the proper days and months are spelled out.
The attached image is from our error log file that shows observations are coming in with Month abbreviations that do not even make sense, we've had this (PMR) as well as AMR show up as the month. This issue is causing our app to display an error message when trying to submit data.
|
| |
| |
| | | |
|
| | |
| |
Posté le 04 avril 2018 - 22:56 |
Hi Claire,
> Could anyone explain this to me?
without knowing where the date is coming from and seeing the corresponding code, no...
I'm "GUESSING" wrong format for a field (return valus 'as is' by example), but without more information, it could be anything...
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
Le 4/4/2018 à 11:24 AM, Claire a écrit : In the project description, the
Language is set to English and because of a problem we had with our iOS version, we had to "hardcode" the date to "Use the Following Parameters" DD-MMM-YYYY and when you click "Days and Months" all the proper days and months are spelled out. The attached image is from our error log file that shows observations are coming in with Month abbreviations that do not even make sense, we've had this (PMR) as well as AMR show up as the month. This issue is causing our app to display an error message when trying to submit data.
|
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 05 avril 2018 - 17:57 |
Hi Fabrice,
Not sure if this information is helpful but we use a php web service to handle the insertion of records into the database.
In the PHP, the only lines that handle the datetime are:
function send_obs($observ) { global $database; //The database and form object
$pieces = explode("|", $observ); //pass list of parameters as a single string separated by |
$obs['username'] = $pieces[0]; $obs['passwd'] = $pieces[1]; $obs['user'] = $pieces[2]; $obs['species'] = $pieces[3]; $obs['lat'] = $pieces[4]; $obs['lon'] = $pieces[5]; $obs['datetime'] = $pieces[6];
and further down in the INSERT statement
$sql .= "'".$obs['datetime']."', "; //"TO_DATE('" . $date . "', 'DD-MON-YYYY'), "; //day
this is the project description:
|
| |
| |
| | | |
|
| | |
| |
Posté le 05 avril 2018 - 19:48 |
Hi Claire
If the code generating the false data is a webservice in php, then you are asking your question on the wrong forum
If the code generating the false data is something in your android app, then you are showing the wrong code.
I any was, something is very wrong here
best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
Le 4/5/2018 à 9:57 AM, Claire CLAIRE a écrit :
Hi Fabrice, Not sure if this information is helpful but we use a php web service to handle the insertion of records into the database. In the PHP, the only lines that handle the datetime are: function send_obs($observ) { global $database; //The database and form object $pieces = explode("|", $observ); //pass list of parameters as a single string separated by | $obs['username'] = $pieces[0]; $obs['passwd'] = $pieces[1]; $obs['user'] = $pieces[2]; $obs['species'] = $pieces[3]; $obs['lat'] = $pieces[4]; $obs['lon'] = $pieces[5]; $obs['datetime'] = $pieces[6]; and further down in the INSERT statement $sql .= "'".$obs['datetime']."', "; //"TO_DATE('" . $date . "', 'DD-MON-YYYY'), "; //day this is the project description:
|
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 05 avril 2018 - 21:24 |
Hi Fabrice, thank you for your input.
I picked this project up last year from someone who left our group and was the one who had developed all of our apps so I am trying to make sense of everything...so far it's not going so well.
Also, a different problem we are having with an iOS app - we are getting this error when we try to receive data on the phone. The files are HFSQL Classic but there are no connections set up in the analysis. It doesn't look like there were ever any connections defined in the analysis but the app was working just fine. Does something need to be set up on our server in order to handle this request? I am at a complete loss as to where to start looking.
|
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 05 avril 2018 - 21:32 |
Hi Fabrice, I just spoke with my boss to get some more detail on the date / month issue. The web service is just a function - the app passes it a string and the web service picks up and explodes it into parts so that we can then grab the date / time and insert it into the database. The string is coming to the web service from the app already incorrect. |
| |
| |
| | | |
|
| | |
| |
Posté le 06 avril 2018 - 12:38 |
Hi Claire,
if the app is working on a local DB (on the mobile), then the settings are correct : HF classic, no connection, local files.
However, the error message is talking about STORED procedures, and sotred procedures are working ONLY against HF C/S, and therefore NOT on a mobile HF classic DB...
As, once again, you are not showing us the CODE that is generating the error, I cannot tell you more than that
best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
Le 4/5/2018 à 1:24 PM, Claire CLAIRE a écrit :
Hi Fabrice, thank you for your input. I picked this project up last year from someone who left our group and was the one who had developed all of our apps so I am trying to make sense of everything...so far it's not going so well. Also, a different problem we are having with an iOS app - we are getting this error when we try to receive data on the phone. The files are HFSQL Classic but there are no connections set up in the analysis. It doesn't look like there were ever any connections defined in the analysis but the app was working just fine. Does something need to be set up on our server in order to handle this request? I am at a complete loss as to where to start looking.
|
| |
| |
| | | |
|
| | |
| |
Posté le 06 avril 2018 - 12:39 |
Hi again,
Le 4/5/2018 à 1:32 PM, Claire CLAIRE a écrit :
Hi Fabrice, I just spoke with my boss to get some more detail on the date / month issue. The web service is just a function - the app passes it a string and the web service picks up and explodes it into parts so that we can then grab the date / time and insert it into the database. The string is coming to the web service from the app already incorrect.
Which is exactly why I was asking for you to show us the CODE that was generating that string, ie the wlanguage code from the mobile app.
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 06 avril 2018 - 14:32 |
Hi Fabrice, my apologies. Hopefully the code below helps.
We have a few windows that capture the system date:
STC_Title = "Observation"
IF gnKingdom = 1 THEN COMBO_Area..State = Grayed ListAdd(COMBO_Density,"NA") ListAdd(COMBO_Density,"Few (<5)") ListAdd(COMBO_Density,"Many (5+)") ELSE COMBO_Area..State = Active ListAdd(COMBO_Density,"NA") ListAdd(COMBO_Density,"Sparse") ListAdd(COMBO_Density,"Patchy") ListAdd(COMBO_Density,"Dense") ListAdd(COMBO_Density,"Monoculture") END IF gbAbsence = True THEN COMBO_Density..Value = 1 COMBO_Density..Visible = False BTN_TakePicture..Visible = False IMG_Photo1..Visible = False IMG_Photo2..Visible = False STC_Photo_Counter..Visible = False ELSE COMBO_Density..Visible = True BTN_TakePicture..Visible = True IMG_Photo1..Visible = True IMG_Photo2..Visible = True STC_Photo_Counter..Visible = True END
IF EXPRESS_observations..NewRecord THEN HReadSeekFirst(EXPRESS_misin_species_all,id,gnSelectedID) IF HFound(EXPRESS_misin_species_all) = False THEN Error("Species not found") RETURN ELSE Start_GPS() STC_CnName = EXPRESS_misin_species_all.cname STC_ScName = StringBuild("%1 %2", EXPRESS_misin_species_all.genus, EXPRESS_misin_species_all.species) STC_CurrentDate = DateToString(DateSys(), "MM-DD-YYYY") STC_Photo_Counter = "# Saved photos: " + gnTotalPicturesTaken + " Max allowed: 20" gnCurrentObsPicturesTaken = 0 gsTempPhoto1 = "" gsTempPhoto2 = "" END ELSE HReadSeekFirst(EXPRESS_observations,EXPRESS_observationsID,gnSelectedObservationID) IF HFound(EXPRESS_observations) = False THEN Error("Observation not found") RETURN ELSE HReadSeekFirst(EXPRESS_misin_species_all,id,EXPRESS_observations.id) IF HFound(EXPRESS_misin_species_all) = False THEN Error("Species not found") RETURN ELSE STC_CnName = EXPRESS_misin_species_all.cname STC_ScName = StringBuild("%1 %2", EXPRESS_misin_species_all.genus, EXPRESS_misin_species_all.species) STC_CurrentDate = DateToString(EXPRESS_observations.datetime, "MM-DD-YYYY") STC_Photo_Counter = "# Saved photos: " + gnTotalPicturesTaken + " Max allowed: 20"
gnSelectedID = EXPRESS_observations.id STC_Latitude = NumToString(EXPRESS_observations.latitude, "3.4f") + "° (N)" STC_Longitude = NumToString(EXPRESS_observations.longitude, "3.4f") + "° (W)" STC_GPSAccuracy = NumToString(EXPRESS_observations.gpsaccuracy / 0.3048, "+5.1f") + " ft" EDT_Comments = EXPRESS_observations.comments IF gnKingdom = 0 THEN COMBO_Area = EXPRESS_observations.area + 1 ELSE COMBO_Area = 1 END COMBO_Density = EXPRESS_observations.density + 1 gnCurrentObsPicturesTaken = 0 gsTempPhoto1 = "" gsTempPhoto2 = "" sTempPhoto is string sThumb is string
IF Length(EXPRESS_observations.photo1) > 1 THEN sTempPhoto = gsTempDir + "photo1_" + DateSys() + "_" + TimeSys() + ".jpg" HExtractMemo(EXPRESS_observations,photo1,sTempPhoto) sThumb = GiveMiniatureName(sTempPhoto) CreateMiniature(sTempPhoto,sThumb) IMG_Photo1 = sThumb gsTempPhoto1 = sTempPhoto gnCurrentObsPicturesTaken = 1 END IF Length(EXPRESS_observations.photo2) > 1 THEN sTempPhoto = gsTempDir + "photo2_" + DateSys() + "_" + TimeSys() + ".jpg" HExtractMemo(EXPRESS_observations,photo2,sTempPhoto) sThumb = GiveMiniatureName(sTempPhoto) CreateMiniature(sTempPhoto,sThumb) IMG_Photo2 = sThumb gsTempPhoto2 = sTempPhoto gnCurrentObsPicturesTaken = gnCurrentObsPicturesTaken + 1 END
END END END Message modifié, 06 avril 2018 - 14:34 |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 06 avril 2018 - 14:43 |
We also have this:
Procedure SubmitData()
sObjectID is string sSendParam is string
nCurrProgBar is int
nConnection is int nResSend is int
sTmpPhoto1 is string sTmpPhoto2 is string
EXPRESS_WIN_MAIN.BTN_Send..Caption = "Connecting..."
WHEN EXCEPTION IN nConnection = FTPConnect(gsFTPServer,gsFTPUser,gsFTPPass,gnFTPPort) IF nConnection = -1 THEN NextTitle("Alert") Error("Unable to connect to the server: ", HError()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" RETURN END DO NextTitle("Alert") Error("Unable to connect to the server: ", HError()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" RETURN END
nCurrProgBar = 0
EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = True EXPRESS_WIN_MAIN.PROGBAR_Send..MinValue = 0 EXPRESS_WIN_MAIN.PROGBAR_Send..MaxValue = gnTotalPicturesTaken + HNbRec(EXPRESS_observations)
IF HNbRec(EXPRESS_observations) = 0 THEN NextTitle("Alert") Info("There are no observations to be sent") EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END
EXPRESS_WIN_MAIN.BTN_Send..Caption = "Sending..."
FOR EACH EXPRESS_observations sDate is string sDate = Upper(DateToString(EXPRESS_observations.datetime, "DD-MMM-YYYY")) sDate = Replace(sDate,".","") sComments is string sComments = "from Android; gps accuracy: " + EXPRESS_observations.gpsaccuracy + "meters " + EXPRESS_observations.comments sSendParam = gsCurrentUserName + "|" + EncodeMD5(gsCurrentUserPassword) + "|" sSendParam = sSendParam + gnCurrentUserID + "|" + EXPRESS_observations.id + "|" + EXPRESS_observations.latitude + "|" + EXPRESS_observations.longitude + "|" sSendParam = sSendParam + sDate + "|" + EXPRESS_observations.area + "|" + EXPRESS_observations.density + "|" sSendParam = sSendParam + sComments + "|||" + EXPRESS_observations.presence sObjectID = submitObservationsImageString21.send_obs(sSendParam) IF ErrorOccurred = True THEN Error("Failure during the call to the Web service", ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END IF sObjectID = "-1" THEN Error("Authentication error. Web service could not validate these credentials", ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END IF sObjectID = "-2" THEN Error("Database error. Web service could not insert a record", ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END nCurrProgBar++ EXPRESS_WIN_MAIN.PROGBAR_Send = nCurrProgBar IF Length(EXPRESS_observations.photo1) > 1 THEN sTmpPhoto1 = gsTempDir + [“/”] + sObjectID + “_” + “1.jpg” HExtractMemo(EXPRESS_observations,photo1,sTmpPhoto1) IF NOT ErrorOccurred THEN nResSend = FTPSend(nConnection, sTmpPhoto1, gsFTPUploadDir) IF ErrorOccurred = True THEN Error("Failure during the FTP put of photo 1 corresponding to objectid = " + sObjectID, ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN ELSE nCurrProgBar++ EXPRESS_WIN_MAIN.PROGBAR_Send = nCurrProgBar END ELSE Error("Error saving photo to a temporary file", ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END END IF Length(EXPRESS_observations.photo2) > 1 THEN sTmpPhoto2 = gsTempDir + [“/”] + sObjectID + “_” + “2.jpg” HExtractMemo(EXPRESS_observations,photo2,sTmpPhoto2) IF NOT ErrorOccurred THEN nResSend = FTPSend(nConnection, sTmpPhoto2, gsFTPUploadDir) IF ErrorOccurred = True THEN Error("Failure during the FTP put of photo 2 corresponding to objectid = " + sObjectID, ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN ELSE nCurrProgBar++ EXPRESS_WIN_MAIN.PROGBAR_Send = nCurrProgBar END ELSE Error("Error saving photo to a temporary file", ErrorInfo()) EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data" EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False RETURN END END HDelete(EXPRESS_observations) END
FTPDisconnect(nConnection) gnCurrentObsPicturesTaken = 0 gnTotalPicturesTaken = 0 NextTitle("Success") Info("Successful Submission") EXPRESS_WIN_MAIN.BTN_Send..Caption = "Send Data"
EXPRESS_WIN_MAIN.PROGBAR_Send..Visible = False
|
| |
| |
| | | |
|
| | |
| |
Posté le 06 avril 2018 - 15:45 |
And how has THAT code anything to do with the end result?
the only thing date related you are doing here is a DateToString(EXPRESS_observations.datetime, "MM-DD-YYYY")
the result of that format is going to be a NUMERICAL date (by example 04/06/2018 for today)...
So, CLEARLY, this has NOTHING to do with what you were showing us before, and specifically nothing to do with a month displayed as an abbreviation...
So, if you cannot show us the ACTUAL CODE GENERATING the problem, and not some random code working on dates for completely something else, NOBODY will be able to help you.
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com
Le 4/6/2018 à 6:32 AM, Claire CLAIRE a écrit :
Hi Fabrice, my apologies. Hopefully the code below helps. We have a few windows that capture the system date: STC_Title = "Observation"
IF gnKingdom = 1 THEN COMBO_Area..State = Grayed ListAdd(COMBO_Density,"NA") ListAdd(COMBO_Density,"Few (<5)") ListAdd(COMBO_Density,"Many (5+)") ELSE COMBO_Area..State = Active ListAdd(COMBO_Density,"NA") ListAdd(COMBO_Density,"Sparse") ListAdd(COMBO_Density,"Patchy") ListAdd(COMBO_Density,"Dense") ListAdd(COMBO_Density,"Monoculture") END
IF gbAbsence = True THEN COMBO_Density..Value = 1 COMBO_Density..Visible = False BTN_TakePicture..Visible = False IMG_Photo1..Visible = False IMG_Photo2..Visible = False STC_Photo_Counter..Visible = False ELSE COMBO_Density..Visible = True BTN_TakePicture..Visible = True IMG_Photo1..Visible = True IMG_Photo2..Visible = True STC_Photo_Counter..Visible = True
END
IF EXPRESS_observations..NewRecord THEN
HReadSeekFirst(EXPRESS_misin_species_all,id,gnSelectedID) IF HFound(EXPRESS_misin_species_all) = False THEN Error("Species not found") RETURN ELSE Start_GPS() STC_CnName = EXPRESS_misin_species_all.cname STC_ScName = StringBuild("%1 %2", EXPRESS_misin_species_all.genus, EXPRESS_misin_species_all.species) STC_CurrentDate = DateToString(DateSys(), "MM-DD-YYYY") STC_Photo_Counter = "# Saved photos: " + gnTotalPicturesTaken + " Max allowed: 20"
gnCurrentObsPicturesTaken = 0 gsTempPhoto1 = "" gsTempPhoto2 = "" END
ELSE HReadSeekFirst(EXPRESS_observations,EXPRESS_observationsID,gnSelectedObservationID) IF HFound(EXPRESS_observations) = False THEN Error("Observation not found") RETURN ELSE
HReadSeekFirst(EXPRESS_misin_species_all,id,EXPRESS_observations.id) IF HFound(EXPRESS_misin_species_all) = False THEN Error("Species not found") RETURN ELSE STC_CnName = EXPRESS_misin_species_all.cname STC_ScName = StringBuild("%1 %2", EXPRESS_misin_species_all.genus, EXPRESS_misin_species_all.species) STC_CurrentDate = DateToString(EXPRESS_observations.datetime, "MM-DD-YYYY") STC_Photo_Counter = "# Saved photos: " + gnTotalPicturesTaken + " Max allowed: 20"
gnSelectedID = EXPRESS_observations.id STC_Latitude = NumToString(EXPRESS_observations.latitude, "3.4f") + "° (N)" STC_Longitude = NumToString(EXPRESS_observations.longitude, "3.4f") + "° (W)" STC_GPSAccuracy = NumToString(EXPRESS_observations.gpsaccuracy / 0.3048, "+5.1f") + " ft" EDT_Comments = EXPRESS_observations.comments
IF gnKingdom = 0 THEN COMBO_Area = EXPRESS_observations.area + 1 ELSE COMBO_Area = 1 END
COMBO_Density = EXPRESS_observations.density + 1
gnCurrentObsPicturesTaken = 0 gsTempPhoto1 = "" gsTempPhoto2 = ""
sTempPhoto is string sThumb is string
IF Length(EXPRESS_observations.photo1) > 1 THEN sTempPhoto = gsTempDir + "photo1_" + DateSys() + "_" + TimeSys() + ".jpg" HExtractMemo(EXPRESS_observations,photo1,sTempPhoto) sThumb = GiveMiniatureName(sTempPhoto) CreateMiniature(sTempPhoto,sThumb) IMG_Photo1 = sThumb gsTempPhoto1 = sTempPhoto gnCurrentObsPicturesTaken = 1 END
IF Length(EXPRESS_observations.photo2) > 1 THEN sTempPhoto = gsTempDir + "photo2_" + DateSys() + "_" + TimeSys() + ".jpg" HExtractMemo(EXPRESS_observations,photo2,sTempPhoto) sThumb = GiveMiniatureName(sTempPhoto) CreateMiniature(sTempPhoto,sThumb) IMG_Photo2 = sThumb gsTempPhoto2 = sTempPhoto gnCurrentObsPicturesTaken = gnCurrentObsPicturesTaken + 1 END
END END
END |
| |
| |
| | | |
|
| | |
| |
Posté le 06 avril 2018 - 15:50 |
at least here you are doing some month work as string...
sDate is string sDate = Upper(DateToString(EXPRESS_observations.datetime, "DD-MMM-YYYY")) sDate = Replace(sDate,".","")
We will have to suppose for now that this is the code causing the problem...
1. How is declared EXPRESS_observations.datetime (type, format, etc)
2. add an info(sDate) after the line with the datetostring in order to make SURE that the error is here and report the result
Best regards
-- Fabrice Harari International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open source WXEDM.
More information on http://www.fabriceharari.com |
| |
| |
| | | |
|
| | |
| |
Membre enregistré 48 messages |
|
Posté le 06 avril 2018 - 16:05 |
Thank you Fabrice, I will focus on those lines and take your suggestions. |
| |
| |
| | | |
|
| | | | |
| | |
|