cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Calculate Birth Date from a different field

My situation is as follows.. In CDS I have created a field in my costumers entity for their social security number which consists of 11 characters. the first six characters of this number (which keep in mind is stored as text data type not as number)  represent the birth date of the costumer. For example someone with the ssn 05118767654 is born in 05 of November 1987 (051187). I also have a birth date field stored as only date data type. My question is:  If I enter the social security number in a form, Is there anyway at all that the date field can be automatically calculated automatically by the first 6 characters of the ssn??

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @George_Serg ,

Put this on a label and see if you get the correct date

With(
   {
      wDay: Left(
         TxtSSN.Text,
         2
      ),
      wMonth: Mid(
         TxtSSN.Text,
         3,
         2
      ),
      wYear: Mid(
         TxtSSN.Text,
         5,
         2
      )
   },
   DateValue(
      wMonth & "/" & wDay & "/" & If(
         Value(wYear) < 20,
         "20",
         "19"
      ) & wYear
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

4 REPLIES 4
Resolver II
Resolver II

@George_Serg 

 

try this formular

 

 

Text(Right(Left(txtSSN.Text,4),2) & "." & Left(txtSSN.Text,2) & "." & Right(Left(txtSSN.Text,8),4),"[$-en]dd/MM/yyyy")

 

If you place a datepicker on your screen ad take this formular as the Default value the control should show the date you enter via the ssn number

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

Memorable Member
Memorable Member

Hi @George_Serg ,

 

If you think to be a calculated field in CDS, I'm affraid that all you can obtain is a text field looking like this:

gabibalaban_0-1603470615265.png

You can set this in calculated field, calculation:

gabibalaban_1-1603470762969.png

and the formula looks like this:

Concat(TrimRight(cr405_ssn, 9), ".", TrimLeft(TrimRight(cr405_ssn, 7), 2), ".", TrimLeft(TrimRight(cr405_ssn, 5), 4))

 where cr405_ssn is your SSN field.

 

Hope it helps !

Hi @George_Serg ,

Put this on a label and see if you get the correct date

With(
   {
      wDay: Left(
         TxtSSN.Text,
         2
      ),
      wMonth: Mid(
         TxtSSN.Text,
         3,
         2
      ),
      wYear: Mid(
         TxtSSN.Text,
         5,
         2
      )
   },
   DateValue(
      wMonth & "/" & wDay & "/" & If(
         Value(wYear) < 20,
         "20",
         "19"
      ) & wYear
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

@WarrenBelzThank you, this is exactly what I was looking for.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (7,084)