General information
Category:
Coding, syntax & commands
>>>>>>>>>>>I would like to have a view parameter that works like a logical, but uses a date field. I have a date field that is either empty or has some value. I would like to bring down the records that are either empty or have some value (regardless of what the value is). Is there some way I can set up a view paramter off of the date field to provide this functionality, or do I need to create another logical field?
>>>>>>>>>>
>>>>>>>>>>It's enough to use datefield equal {} (or NOT equal {}).
>>>>>>>>>
>>>>>>>>>How do you do that in a view parameter? You can't set the value of a view parameter to an expression.
>>>>>>>>
>>>>>>>>Why do you use 'expression'. You should just select datefield as 'Field Name' (View Designer: Selection Criteria tab), and type {} in 'Example'.
>>>>>>>
>>>>>>>That works if I always want the records with the date field being empty. I want the user to be able to choose (ie. parameterized) between empty and !empty.
>>>>>>
>>>>>>I think the simplest way is to use programmatic Select ... into Cursor, or you can use two views.
>>>>>
>>>>>If you define the view in code you can put in the WHERE clause
>>>>>
>>>>>empty(date) = glempty_or_not
>>>>>
>>>>>and set glempty_or_not to .T. or .F. depending on what the user wants
>>>>
>>>>Excellent solution, and can be implemented through View Designer too. Surely, it's better to have index tag on empty(date).
>>>
>>>Before I posted this, I tried it in the view designer, and couldn't get it to accept it. If you get it to work, I would like to know how.
>>
>>Tested w/out problems. This is View-SQL string:
>>SELECT *;
>> FROM table1;
>> WHERE EMPTY(Table1.date1) = ?l1
>
>Well, I don't know what I was doing wrong before, but it works now for me too. tnx
Ed & Erik,
Thank you both for your help. One more issue on this, will the EMPTY function call create a problem for a remote view when the data is upsized?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only