Data type problem

I am writing a Run on Server agent, trying to modify a view programmatically that will be an embedded view on MemoDocument form … This is what I want as an end result.

SELECT Form = “MemoDocument” & AuthorDate = @TextToTime(“04/09/1992”)

I am having a problem with the AuthorDate portion… it is a date datatype… This code below does not work and I am not sure where the issue lies. SelAuthorDate is date/time datatype - Author Date on the MemoDocument form is date/time datatype.

formula$ = “SELECT Form = ‘MemoDocument’ & AuthorDate = @TextToTime({”& SelAuthorDate &“})”

Subject: RE: Data type problem

In what sense does it not work? Why do you assume the problem is with this statement? I think it’s earlier, where you failed to assign SelAuthorDate with the correct value. But since you only show one line of code, it’s hard to know.

By the way, it’s better to express date constants using square brackets:

formula$ = “SELECT Form = ‘MemoDocument’ & AuthorDate = [” & SelAuthorDate &“]”

If the above does not solve your problem, we need more information about what you’re doing. If you’re not sure what information to supply, the C R I S P Y document might help you.

  • Andre Guirard, IBM/Lotus Development

Useful blog: Best Practice Makes Perfect

Subject: RE: Data type problem

so what I want is something like this?..SELECT Form = “MemoDocument” & AuthorDate=@Date([04/09/1992])

I know it is this line of code that is crashing because 1) I take the date part out and it works and 2) The log tells me where it crashes.

Here is where I assign the variable…

SelAuthorDate = Doc.AuthorDate… it is not a multi-value field.

Subject: RE: Data type problem

You don’t seem to have read the CRISPY document, because you still haven’t said what your error message is. However, I am able to deduce it must be “Type mismatch.”

Please read this article, which describes exactly what’s causing your error.

No, I’m not saying you should use @Date([04/09/1992]). The code I posted showed exactly what I meant. [04/09/1992] is already a date – there’s no point in using @Date on it.

Incidentally, I have some concerns about your design approach. You needn’t be modifying a shared view just to display all the documents for a single day. This will give poor performance as you get more documents, and users will interfere with each other because they’re going to be trying to modify the same view for different dates.

Instead, create a view categorized by date and use the single category formula of the embedded view to display the appropriate day’s documents.