Topic: ComboBox filtering in GridView based on employees Birthdays

Hello all, MVD community,

I'm working on this project where I have a form to enter employee's last name, first name, date of birth ( using all textbox fields). I want to display on a new form that has a comboBox with the months of the year, to filter the information from the table employees, based on the month of their birthday.  For example:  if I select 'January' on the comboBox of the second form, it should display all employees who's birthday are on January in the tablegrid. and so on.   I have attached a screen with what I mean, hope you can help me!  thanks.


https://image.ibb.co/jFoEVa/month.png
imagen link html

Re: ComboBox filtering in GridView based on employees Birthdays

Hello gonpublic2K

This attachment could help you

JB

Post's attachments

Attachment icon FIND IN A COMBOBOX.zip 434.11 kb, 533 downloads since 2017-03-23 

Re: ComboBox filtering in GridView based on employees Birthdays

jean.brezhonek wrote:

Hello gonpublic2K

This attachment could help you

JB

Thank you Jean, I took a look but didn't understand most of the script.  Basically I need to find in the table employees the field of birthdays, which I named 'HBD' and use that string capturing the part of the 'month' and day only, So when you pick a month from the drop-down in the comboBox, it displays all employees that were born in that month.   This way it filters only the information that you need from the comboBox.   It's a bit complicated I guess, I'll keep on looking for answers.

Re: ComboBox filtering in GridView based on employees Birthdays

Hi Gonpublic,
Maybe the attached project will help you.
I have used a calculated field (employees.cfmonth) to temporarily store the month (in english, sorry!).
You can then compare the month selected in form1.combobox1 with employees.cfmonth to filter those employees with birthdays in that month.
Because there is no relationship between the 'employees' and 'months' tables, I use a very small script to copy the value from form1.combobox1 to form1.edit1 (defined as employees.cfmonth) so that form1.edit1 can be used as the search filter.
But there will be other ways as well - this is just one suggestion.
Regards,
Derek.

Post's attachments

Attachment icon gonpublic birthday.zip 339.39 kb, 534 downloads since 2017-03-24 

Re: ComboBox filtering in GridView based on employees Birthdays

gonpublic2k
Please attach your project.

Dmitry.

Re: ComboBox filtering in GridView based on employees Birthdays

derek wrote:

Hi Gonpublic,
Maybe the attached project will help you.
I have used a calculated field (employees.cfmonth) to temporarily store the month (in english, sorry!).
You can then compare the month selected in form1.combobox1 with employees.cfmonth to filter those employees with birthdays in that month.
Because there is no relationship between the 'employees' and 'months' tables, I use a very small script to copy the value from form1.combobox1 to form1.edit1 (defined as employees.cfmonth) so that form1.edit1 can be used as the search filter.
But there will be other ways as well - this is just one suggestion.
Regards,
Derek.

Great! , thanks Derek, that seemed to work fine.  Another question, what if instead of using a DateTimePicker to enter the date, I have used a textbox in the format of:  mm/dd/yyyy , how would a calculated field work for that approach?

Re: ComboBox filtering in GridView based on employees Birthdays

Hi,
If you are using a text field, then you can use substr instead of strftime - for example substr(textbirth,1,2) will take 2 characters, starting in position1 (which should work for your mm/dd/yyyy text field format).
Please see attached.
Regards,
Derek.

Post's attachments

Attachment icon gonpublic text birthday.zip 342.56 kb, 553 downloads since 2017-03-27 

Re: ComboBox filtering in GridView based on employees Birthdays

hi derek, I have sent you a message, did you get it?

Re: ComboBox filtering in GridView based on employees Birthdays

derek wrote:

Hi,
If you are using a text field, then you can use substr instead of strftime - for example substr(textbirth,1,2) will take 2 characters, starting in position1 (which should work for your mm/dd/yyyy text field format).
Please see attached.
Regards,
Derek.

Awesome, excelent example.  Thanks!!