If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#52259 by cishpix
Wed Dec 04, 2019 12:41 pm
Hi all,
I want to create a calendar can show all of my customer birthday. So, when I create a customer and input their birthday in Customer BO, how can it can input automatically into Appointment BO and set repeat every years?
Is it possible?

Thanks
#52261 by idpSteve
Wed Dec 04, 2019 4:10 pm
I do this with an extra attribute, and a scheduled process that runs at 00:01 on the 1st of January.

I have DateOfBirth and BirthdayThisYear as two date attributes, then a rule that says

Person.BirthdayThisYear=AS_DATE(
AS_STRING(DAY_OF_MONTH(Person.DateOfBirth))+'-'+
AS_STRING(MONTH(Person.DateOfBirth))+'-'+
AS_STRING(CURRENT_YEAR),'dd-MM-yyyy')

I set this when DateOfBirth attribute is changed, and also in a process at the beginning of each year.
#52263 by Jaymer
Wed Dec 04, 2019 6:39 pm
@Dumas - Example of how context is important.. And since we don’t know the specifics of how the library application was written, it’s hard to make decisions based on what we see in its code. If I have 1 million customers, then I probably do not want 10 million erroneous rows in a table. And I may want to do it at the beginning of the year like Steve said. But if I had to do this in this current app that I’m converting, and I see that My client, in 10 years of legacy data, they only have 750 vendors, then wasting some space in de normalizing data to make programming easier is not gonna have a negative impact on the MSSQL database. Because I know the vendor file isn’t going to grow to tens of thousands.

I would create a birthdays BO, and add it to the appointment group.
Since someone’s birthday is not going to change, you could just decide to create birthday events out in the future. Then they would show up on the calendar.
Personally, I have not explored how recurring events work. If you enter an event to occur 10 times, Does it behind the scenes create 10 records?
If it does, then you could create a process to create 10 years or 50 years worth of birthdays in the file.
(Not being in front of my computer, I don’t know if recurs has a yearly option Or if it’s only days or weeks or months. You can’t say recurs every 365 days because of leap year. So I’m not sure if recurring for a yearly event is even valid.)
50 years probably is an exaggeration. Your App will not be in use in 50 years so that’s irrelevant.
But pre-generating his next 10 birthdays is probably not an issue. How many customers you’re going to have 700? 2500? Then 25,000 birthday records in a file is certainly no big deal. In 10 years if you’re alive and your app is still being used in aware, You can worry about generating 10 more years worth of data.
#52264 by PointsWell
Wed Dec 04, 2019 9:16 pm
Create a single Appointment BO and use the recurrence field to set an annual recurrence (controlled by RecRule attribute).

I have a Contact BO that has a field DateOfBirth and off of that I create an owns single relationship to an Appointment Group BO called DateOfBirth, when you add the Date of Birth on the Contact BO a Rule then either creates the DateOfBirth and sets it's ownership to the Contact and sets the RecRule to be:

Code: Select allDateOfBirth.RecRule='FREQ=YEARLY;BYMONTH='+MONTH(Contact.DateOfBirth)+';BYMONTHDAY='+DAY_OF_MONTH(Contact.DateOfBirth)+';WKST=SU'


Or if there is already a Date of Birth (and consequently a DateOfBirth Appointment BO),
Code: Select allIF Contact.osDateOfBirth IS DEFINED AND Contact.DateOfBirth WAS CHANGED THEN Contact.osDateOfBirth.StartTime=Contact.DateOfBirth Contact.osDateOfBirth.EndTime=Contact.DateOfBirth


This way you end up with one appointment record so that when you accidentally put the wrong date in you can correct it once without reprocessing.

I use Appointment objects extensively and create multiple Appointment BOs for the various different types of date I want to record. I had previously worked with a generic Appointment BO that became overly cumbersome to manage it depending on what type of date it was recording as it required additional fields in the Appointment record and more redundancy. It also makes it easier to manage Forms as I can create different Forms for each Appointment BO and not have to create code to display the correct form when I have multiple Appointment BO. But that is my personal preference, I prefer to not generate code where I can offload it to AIM.

From memory the RecRule only sets one Appointment BO instance.
#52289 by cishpix
Fri Dec 06, 2019 3:47 pm
PointsWell wrote:I have a Contact BO that has a field DateOfBirth and off of that I create an owns single relationship to an Appointment Group BO called DateOfBirth, when you add the Date of Birth on the Contact BO a Rule then either creates the DateOfBirth and sets it's ownership to the Contact and sets the RecRule to be:

CODE: SELECT ALL
DateOfBirth.RecRule='FREQ=YEARLY;BYMONTH='+MONTH(Contact.DateOfBirth)+';BYMONTHDAY='+DAY_OF_MONTH(Contact.DateOfBirth)+';WKST=SU'


Or if there is already a Date of Birth (and consequently a DateOfBirth Appointment BO),
CODE: SELECT ALL
IF Contact.osDateOfBirth IS DEFINED AND Contact.DateOfBirth WAS CHANGED THEN Contact.osDateOfBirth.StartTime=Contact.DateOfBirth Contact.osDateOfBirth.EndTime=Contact.DateOfBirth



Hi PointsWell, many thanks for your respond. I have test and it works for new data created and update the new data.

I have question.
Suppose I have already input a couple of customers data (more than 100) that still have not connection into Appointment BO. I try the above your suggestion but unfortunately the old data (birthday) cannot be create in Appointment. So, I try set it ( Contact.osDateOfBirth IS UNDEFINED ) but I'm still stuck.
Do you have any good idea?

Thank you.
#52294 by PointsWell
Fri Dec 06, 2019 7:21 pm
cishpix wrote:
PointsWell wrote:I have a Contact BO that has a field DateOfBirth and off of that I create an owns single relationship to an Appointment Group BO called DateOfBirth, when you add the Date of Birth on the Contact BO a Rule then either creates the DateOfBirth and sets it's ownership to the Contact and sets the RecRule to be:
Code: Select allDateOfBirth.RecRule='FREQ=YEARLY;BYMONTH='+MONTH(Contact.DateOfBirth)+';BYMONTHDAY='+DAY_OF_MONTH(Contact.DateOfBirth)+';WKST=SU'


Or if there is already a Date of Birth (and consequently a DateOfBirth Appointment BO),
Code: Select allIF Contact.osDateOfBirth IS DEFINED AND Contact.DateOfBirth WAS CHANGED THEN Contact.osDateOfBirth.StartTime=Contact.DateOfBirth Contact.osDateOfBirth.EndTime=Contact.DateOfBirth



Hi PointsWell, many thanks for your respond. I have test and it works for new data created and update the new data.

I have question.
Suppose I have already input a couple of customers data (more than 100) that still have not connection into Appointment BO. I try the above your suggestion but unfortunately the old data (birthday) cannot be create in Appointment. So, I try set it ( Contact.osDateOfBirth IS UNDEFINED ) but I'm still stuck.
Do you have any good idea?

Thank you.


Two processes
Process 1
Code: Select allFIND Contact where Contact.osDateOfBirth is undefined AND Contact.DateOfBirth is DEFINED
Process2


Process 2
Input Contact
Code: Select allCreate DateOfBirth With
DateOfBorth.StartDate= ContactDateOfBirth,
DateOfBorth.StartDate= ContactDateOfBirth,
[fill in the rest of the necessary Appointment attributes]
Contact.osDateOfBirth=DateOfBirth


call the process1 as a once off This will create all the DateOfBirth Appointment BOs that are missing

To do it on a one by one basis modify the BO rule for Date Of Birth to be
Code: Select allIF Contact.DateOfBirth WAS CHANGED and Contact.DateOfBirth IS DEFINED  AND Contact.osDateOfBirth IS UNDEFINED THEN
CREATE DateOfBirth with DateOfBirth.obContact etc etc ELSE
IF Contact.DateOfBirth WAS CHANGED and Contact.DateOfBirth IS DEFINED  AND Contact.osDateOfBirth IS DEFINED THEN
Contact.osDateOfBirth.StartTime=Contact.DateOfBirth Contact.osDateOfBirth.EndTime=Contact.DateOfBirth Etc etc


On reflection I should have named the BO something other than DateOfBirth :D
#52303 by cishpix
Sun Dec 08, 2019 11:46 am
PointsWell wrote:call the process1 as a once off This will create all the DateOfBirth Appointment BOs that are missing

Many thanks for you, my issue have been solved.

Who is online

Users browsing this forum: Google [Bot], Rem and 8 guests