Author Topic: Searching for Modified AB records  (Read 1909 times)

CathDillimore

  • Member
  • *
  • Posts: 2
Searching for Modified AB records
« on: October 18, 2011, 04:52:39 PM »
Hi,

I have a date field called Main::LastSync which I intend to set after each time the address book is synced with FM.

So the next time I go to sync I will only want to find the records modified or added into the address book since that Date.

This is the search I am caring out, which seems to fail.

PCAB_Search("Contact" ;"Modified Date" ;"" ;"" ;Main::LastSync;"GreaterThanOrEqual";"")

Can someone help with the syntax. :-\ I must have it wrong.

Ideally I'd also like Main::LastSync to be a timestamp....but is the Modified Date in the Address book a date or a timestamp?


Cheers,

Cath

Chris

  • God
  • Member
  • *****
  • Posts: 83
Re: Searching for Modified AB records
« Reply #1 on: October 20, 2011, 04:09:05 PM »
Try this....

Store LastSync as a TimeStamp.

...
Set Variable[ $interval ; GetAsNumber( Get( CurrentTimeStamp ) ) - GetAsNumber( Main::LastSync ) ]
Set Variable[ $r ; PCAB_Search("Contact" ;"Modified Date" ;"" ;"" ; $interval ;"WithinIntervalAroundToday";"") ]
...

'WithinIntervalAroundToday' takes seconds as the operand and $interval will contain the number of seconds between now and 'LastSync'.



CathDillimore

  • Member
  • *
  • Posts: 2
Re: Searching for Modified AB records
« Reply #2 on: October 25, 2011, 01:37:18 PM »
Waho, easy when you know how!

Thanks Chris ;D

Just for any one else reading this Modified Date in the Address book is a timestamp. Also, instead of setting PCAB search function into a variable as Chris demonstrated, I set it into Main::gResult to incorporate it into the Productive computing Demo file code.

The search function either returns the number of records found in the address book or "!!ERROR!!" if no records found.