Hi All,
I want to search date of birth using text variable.
In OutSystems entity I have date of birth attribute of text type. And I have saved dates as below,
while showing date of birth on the dashboard. I did conversion of text into date and showing in below format ,
FormatDateTime(TextToDate(GetDateOfBirths.List.Current.DateOfBirth.DateOfBirth),"dd MMM yyyy")
Now I am facing issue while search the date just because of this conversion.
If I search the date as 12 Dec 1963 Its not showing the results
And If I search the date like 1963-12-12 then its showing the result because its matching the text record in the entity.
But I want to search the date like this for e.g 12 Dec 1963 and It should show the result.
I have tried many conversion ways but still its not working as expected.
Can anyone suggest how can I achieve this outcome ?
I am attaching the sample oml for the same.
Thanks.
Hello @Ajit Kurane ,
Please find attached oml file.Demo link: -demoI have created some attribute in aggregate with the help of that attribute you may search by using
1.Name2.date in formate 2024-06-063.Month name like Jan,Feb,Mar etc
4.Month number like 01,02,03 etc
5.Year like 2022,2023,2024 etc
6. search key like 4 Ap,3 M,5 Jun etc
Hope this will help you.
Thanks,
Yogesh
Amazing!!!!!..Thank you so much expert for this one.
In your entity, the data type for the date of birth is set as text. Therefore, searching for "12 Dec 1963" will not yield any results because the data is stored in the format "1963-12-12". There is no data matching "12 Dec 1963".
In your code, when you type the search text, the aggregate is refreshed, fetching data from the database rather than just filtering on the screen. Thus, your statement "Now I am facing issues while searching the date just because of this conversion" is incorrect.
One possible solution is to convert your input data to the "yyyy-MM-dd" format and search in the database.
I am facing the issue while converting the input in the above format and search in the database. Do you have any solution on that ?
Are you planning to handle any date format or have a specific format for dates? Also, is this keyword used to match any other field in the database?
btw TextToDate is expecting the input in a particular format to convert to date. ( Examples:TextToDate("2002-01-01") = #2002-01-01# TextToDate("2002/01/01") = #2002-01-01# TextToDate("2002.01.01") = #2002-01-01# TextToDate("2002-25-01") = #1900-01-01# TextToDate("2002/02/31") = #1900-01-01# TextToDate("10000.01.01") = #1900-01-01# )
None of these match "12 Dec 1963," so this is returning the default date.
You may need to do string manipulation to compose a date from the input, which seems risky if the entered data is in an incorrect format.