Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Recurrence

I have a question about the Recurrence class.

Is this a material/bean class or does it contain calculation logic?

If i create a Recurrence instance and set, lets say, startDate to today, endDate to today in 1 year and dayInWeek to 1:

Could i query the object and get a list of QDateTimes that represent the occurrence?

If not, is there an exposed API that calculates the occurrences?

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
BlackBerry Development Advisor
mwoolley
Posts: 559
Registered: ‎06-25-2010
My Carrier: Vodafone

Re: Recurrence

Hi Simon

 

hope I haven't misunderstood your question but doesn't the occurrenceDates() function give you what you're referring to?

 

https://developer.blackberry.com/native/reference/cascades/bb__pim__calendar__recurrence.html#functi...

 

Regards

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Recurrence

yes, my question is if this method returns a list of items (i.e. creates them) if some parameters were set.

Or if it is just a bean class without any logic in it.

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
BlackBerry Development Advisor
mwoolley
Posts: 559
Registered: ‎06-25-2010
My Carrier: Vodafone

Re: Recurrence

OK, I see what you mean now :-)

 

I don't know.... so why don't I find out and get back to you?

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Recurrence

It seems like it is not a "smart class", only a bean.

My test:

bb::pim::calendar::Recurrence recurrence;
QDateTime current = QDateTime::currentDateTime();
recurrence.setStart(current);
recurrence.setEnd(current.addYears(1));
recurrence.setFrequency(bb::pim::calendar::Frequency::Daily);
QList<QDateTime> occurrenceDates = recurrence.occurrenceDates();
qDebug() << "occurrenceDates:"<<occurrenceDates.size();

It should print 365, but gives 0.

 

It would be really great if you could ask around internally if I could somehow access the algorithm to calculate the occurrences.

I already created a theoretical model that should work, but it is quite complex and error prone, and if i could spend the week i would probably need to implement and test it on something else i would be quite happy :smileyhappy:

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
BlackBerry Development Advisor
mwoolley
Posts: 559
Registered: ‎06-25-2010
My Carrier: Vodafone

Re: Recurrence

I did pretty much the same as you and reached the same conclusion :-)

 

Yes, I'll do that.

 

Cheers

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
BlackBerry Development Advisor
mwoolley
Posts: 559
Registered: ‎06-25-2010
My Carrier: Vodafone

Re: Recurrence

Yes, confirmed by development that this is just a "data container" as they call it.... a bean.

 

When asked about algorithm they pointed out the existence of a couple of libraries in the open source world, one in C and the other in python:

 

http://sourceforge.net/projects/freeassociation/

 

This is written in c.

 

http://labix.org/python-dateutil

 

This is written in python.

 

Hope this helps

 

Martin

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.
Developer
simon_hain
Posts: 15,558
Registered: ‎07-29-2008
My Carrier: O2 Germany

Re: Recurrence

Maybe i should have waited for your answer :smileyvery-happy:
I am currently at about 3/4 of my implementation, about 600 code lines.

Free Association( libical) looks quite good. Can you ask them if they have compiled it successfully on bb10?
I'll try to compile it tomorrow and take a look at the API, while i spent a lot of work on it i guess the lib is more bug-free and better performing.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
BlackBerry Development Advisor
mwoolley
Posts: 559
Registered: ‎06-25-2010
My Carrier: Vodafone

Re: Recurrence

I should have been quicker answering :-)

 

Time zones!

 

I'll ask and let you know what they say. With a bit of luck it will be an easy port if they haven't.

--------------------------------------------------------------------------------------------
Feel free to press the like button on the right side if you liked my attempts to help :-)
And please mark posts as solved if you think I found the solution or set you on its path. Thanks!
Follow me on Twitter: @mdwrim
Please use plain text.