Source language: Translate to:

StartDate has no default value

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

StartDate has no default value

Postby BRobinsonS » Mon Jul 02, 2012 5:39 pm

Neobook is reporting 'StartDate has no default value'.
Below is the area I am working with trying to filter between two dates working with modifying the Address Example (I am making a lot of progress).

Searched on forum for ideas but not sure why I am getting this message.
*************
.build search filter
SetVar "[Filter]" ""
DefineVar "[StartDate]" "Date" "mm/dd/yyyy" "Global" "01/01/2000"
.SetVar "[StartDate]" "1/1/1980"
.Active Date filter
IfEx "[sFromDate] > '' and [sToDate] > '' "
. DateToNum "[sFromDate]" "m/d/y" "[StartDate]"
. DateToNum "[sToDate]" "m/d/y" "[FinishDate]"
. Math "[FinishDate]-([StartDate])+1" "0" "[Result]"
. AlertBox "Answer" " [Result] days between dates"

SetVar "[Filter]" "StartDate between #[sFromDate]# and #[sToDate]#"
Else
AlertBox "Date Empty" "Please fill in both dates"
EndIf
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Neosoft Support » Tue Jul 03, 2012 10:40 am

The value of [StartDate] is valid, but your IfEx action is examining the contents of the variables [sFromDate] and [sToDate], both of which are undefined in your code.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby BRobinsonS » Tue Jul 03, 2012 1:19 pm

Both sFromDate and sToDate are variable from fields on a form.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Neosoft Support » Wed Jul 04, 2012 10:10 am

I tried your code here with two text entry fields and it seems to work fine. The only thing I can think of is that you have a typo somewhere.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby Wrangler » Thu Jul 05, 2012 8:15 am

IfEx "[sFromDate] > '' and [sToDate] > '' "


This syntax doesn't look right. Greater than what?
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby Gaev » Thu Jul 05, 2012 1:00 pm

Wrangler:
Greater than what?
Those are two single-quotes ... on this forum they look like one double-quote.

I think he is trying to check if the value in the [variable] is greater than null.

@Brian:

Just before the ...
IfEx "[sFromDate] > '' and [sToDate] > '' "
... command, insert ...
Alertbox "Before" "... [sFromDate] ... [sToDate]"
... so you can tell what values you are comparing.

Just after the ...
IfEx "[sFromDate] > '' and [sToDate] > '' "
... command, insert ...
Alertbox "After" "... was true"
... so if it pops up, you will know whether the IfEx command considered the condition to be true (or not).

Also, where exactly is it that ... Neobook is reporting 'StartDate has no default value'. ... i.e. before/after which command ?


By the way, another technique for checking if the variables are empty/null or not ... is to ...
Code: Select all
IfEx "abcd = abcd[sFromDate] OR pqrs = pqrs[sToDate]"
   ... one/both conditions true; so one/both fields empty/null
Else
   ... neither field is empty
EndIf

... i.e. abcd = abcd[variable] will be true only if [variable] is null/empty.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby BRobinsonS » Fri Jul 06, 2012 9:33 am

Just about to add information when I noticed two responses.
I have been over the code and can't find any typos. Perhaps it is my lack of understanding of variables with Neobook and NeobookDBPro.

This syntax doesn't look right. Greater than what?


Yes two single quotes.

Alertbox "Before" "... [sFromDate] ... [sToDate]"

Shows the correct dates.
fyi: I have one record that has a Date of 10/11/2012 but I want to search for all dates between 10/1/2012 and 10/31/2012. So results would be 1 result.

After Ifex
AlertBox "sFromDate sToDate Start" "[sFromDate] and [sToDate] and [StartDate]"

Showed the right values too.

Also, where exactly is it that ... Neobook is reporting 'StartDate has no default value'. ... i.e. before/after which command ?


It gets into the IfEx (if I put in dates if not reports that dates need to be filled in) when the message pops up.

Does not DefineVar "[SearchDate]" "Date" "m/d/y" "Global" "1/1/00" set a default value and do I have to use Setvar as well?
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Wrangler » Fri Jul 06, 2012 9:38 am

Just for the halibut, try this:

IfEx "[sFromDate] <> [#34][#34] and [sToDate] <> [#34][#34] "
Wrangler
--------------
"You never know about a woman. Whether she'll laugh, cry or go for a gun." - Louis L'Amour

Windows 7 Ultimate SP1 64bit
16GB Ram
Asus GTX 950 OC Strix
Software made with NeoBook
http://highdesertsoftware.com
User avatar
Wrangler
 
Posts: 1505
Joined: Thu Mar 31, 2005 11:40 pm
Location: USA

Postby BRobinsonS » Fri Jul 06, 2012 9:58 am

Search Screen and Message:
I have changed variable name from StartDate to SearchDate.
Same Results.

Image
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby BRobinsonS » Fri Jul 06, 2012 10:25 am

IfEx "[sFromDate] <> [#34][#34] and [sToDate] <> [#34][#34] "


I get syntax error if I leave the dates blank, but it also made me realize I have to add a checkbox with if statement to use Dates or not, because the first filter in the code is to use dates.

Just another example of how one problem points out another problem.

Always learning

:D
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby BRobinsonS » Sat Jul 07, 2012 5:17 am

After much thought, I think my problem is that my variable SearchDate does not relate or refer to the database field [AddrBook.Contacts.ActiveDate].

What I am trying to accomplish is a query for New members whose active date of membership can be searched on. i.e. New members whose active date is in October 2011 so between 10/1/2011 and 10/31/2011.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Gaev » Sat Jul 07, 2012 7:14 am

Brian:

It does not help to get tidbits of information about your (modified) application ... perhaps you can start by posting an exact copy of the script associated with the OK button ... and surround it with [ code] and [ /code] tags (no spaces) to make it easier to read.
User avatar
Gaev
 
Posts: 3716
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby BRobinsonS » Sat Jul 07, 2012 8:17 am

As requested, OK button action contents.
Most code has not been changed. I added and focused on Date filtering.
SearchDate should refer to ActiveDate field in Contacts table

.build search filter
SetVar "[Filter]" ""
.Active Date filter
.Alertbox "Before" "... [sFromDate] ... [sToDate]"
If "[UseDates]" "=" "Checked"
IfEx "[sFromDate] > '' and [sToDate] > '' "
. DateToNum "[sFromDate]" "m/d/y" "[StartDate]"
. DateToNum "[sToDate]" "m/d/y" "[FinishDate]"
. DateToNum "[AddrBook.Contacts.ActiveDate]" "m/d/y" "[SearchDate]"
. Math "[FinishDate]-([StartDate])+1" "0" "[Result]"
. AlertBox "Answer" " [Result] days between dates"
. AlertBox "sFromDate sToDate StartDate" "[sFromDate] and [sToDate] and [StartDate]"
. SetVar "[SearchDate]" "01/01/2000"

. [sFromDate] and [sToDate] fields on Search dialog form
SetVar "[Filter]" "SearchDate Between #[sFromDate]# and #[sToDate]#"
. AlertBox "filter" "[Filter]"

Else
AlertBox "Date Empty" "Please fill in both dates"
EndIf

EndIf
.set Member Number
If "[sMemNo]" ">" ""
SetVar "[Filter]" "MemNo LIKE [#34]%[sMemNo]%[#34]"
EndIf

If "[sFirstName]" ">" ""
SetVar "[Filter]" "FirstName LIKE [#34]%[sFirstName]%[#34]"
EndIf

If "[sLastName]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]LastName LIKE [#34]%[sLastName]%[#34]"
EndIf

If "[sCompany]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Company LIKE [#34]%[sCompany]%[#34]"
EndIf

If "[sStreet]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Street LIKE [#34]%[sStreet]%[#34]"
EndIf

If "[sCity]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]City LIKE [#34]%[sCity]%[#34]"
EndIf

If "[sState]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]State LIKE [#34]%[sState]%[#34]"
EndIf

If "[sZip]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Zip LIKE [#34]%[sZip]%[#34]"
EndIf

If "[sCountry]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Country LIKE [#34]%[sCountry]%[#34]"
EndIf

If "[sTelephone]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Telephone LIKE [#34]%[sTelephone]%[#34]"
EndIf

If "[sEMail]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]EMail LIKE [#34]%[sEMail]%[#34]"
EndIf

If "[sMemType]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]MemType LIKE [#34]%[sMemType]%[#34]"
EndIf

If "[sComments]" ">" ""
If "[Filter]" ">" ""
SetVar "[Filter]" "[Filter] [Operator] "
EndIf
SetVar "[Filter]" "[Filter]Comments LIKE [#34]%[sComments]%[#34]"
EndIf

If "[Filter]" ">" ""
dbpQuery "AddrBook" "Contacts" "[Filter]"
If "[AddrBook.Contacts.$RecCount]" "=" "0"
AlertBox "Query" "No matching records found."
dbpShowAll "AddrBook" "Contacts"
EndIf
Else
dbpShowAll "AddrBook" "Contacts"
EndIf

CloseCustomWindow "QueryDialog"
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby BRobinsonS » Sat Jul 07, 2012 8:24 am

My apology and thanks for the support.

Changed SearchDate to ActiveDate like in the name of field and it worked.

:oops: :oops: :oops:

Learned alot.
Brian Robinson
'When all else fails, try again!'
www.ComputerSoftwareSystems.com
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 2 guests