Problem in ID No

Hi

I have ID No field on a form. My code generates ID no after saving. Code checks the previous saved ID no in the view and accordingly increment the ID no value. First I am searching for current year document in view i.e. 2008 and then code has to filter documents out of current year filtered documents. Now I am not able to understand how can getalldocumentbykey can be used for both “Current Year” and “Branch Location”. I have used FTsearch method but of no use. Code below is:

Set loView=lodb.getview(“Counter”)

Call loView.Refresh

branchLoc=louidoc.Fieldgettext(“Branch_Loc”)

curr_year=louidoc.FieldGetText(“curr_year”)

Set loDocColl=loView.GetAllDocumentsByKey(curr_year, True)

If loDocColl.Count > 0 Then

Call loDocColl.FTSearch(branchLoc, 0)

If loDocColl.count=0 Then

Set loDoc=loDocColl.GetfirstDocument

msgbox loDoc.ID_no(0)

end if

end if

But FTSearch shows document with relevance. So getfirstdocument and getlastdocument fails.

Please suggest some other method as I need to first filter docs on Current Year basis and then from that filtered documents I need to filter more on Branch Location.

Please help. Thanks

Subject: Problem in ID No

Using FTSearch may not be a good idea. Search index is updated on server at its own pace. Normally once in an hour. (Setting immediate index update option will have performance hit).

You can create a new with first sorted column as “curr_year”, second sorted column as “Branch_Loc”

Dim keys ( 1 to 2) As String

keys(1) = louidoc.FieldGetText(“curr_year”)

keys(2) = louidoc.Fieldgettext(“Branch_Loc”)

Set loDocColl=loView.GetAllDocumentsByKey(keys, True)

Well, if that doesn’t work let’s simplify it a bit. In the View have only one sorted column with formula: curr_year + “-” + Branch_Loc.

And then search for:

Set loDocColl=loView.GetAllDocumentsByKey(louidoc.FieldGetText(“curr_year”) + “-” + louidoc.Fieldgettext(“Branch_Loc”), True)

Regards,

Litty Joseph