• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

calculating date of conception

Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

Hello everyone, 

I need help please.

I have three fields 

the first ist the lenthe of the embryo (LCC)

the seconde is the gestationnel age (Terme LCC)

the thrird is the date of conception (DG LCC)

when I choose the lenthe (LCC) of 10,2 mm that gives me (Terme LCC)  7 weeks 

i need to calculate the date befor 7 weeks 

every time i change the lenthe the Terme LCC changes 

help please

 

Capture d’écran 2022-02-22 à 21.19.00.png

TOPICS
Acrobat SDK and JavaScript , Mac

Views

783

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , Feb 22, 2022 Feb 22, 2022

So whatever number is in "Terme LCC" that many weeks should calculate?

If yes to above, use this as 'Validation' script of "Terme LCC" field and change "dd-mmm-yyyy" to whichever date format you want:

 

var date = new Date();
if(event.value == "")
this.getField("DG LCC").value = "";
else {
var str = event.value;
var n = str.match(/\d/g);
var num = n.join("");
date.setDate(date.getDate() -num*7);
this.getField("DG LCC").value = util.printd("dd-mmm-yyyy", date);}

 

Votes

Translate

Translate
Community Expert , Feb 23, 2022 Feb 23, 2022

Try this:

var date = new Date();
if(event.value == "")
this.getField("DG LCC").value = "";
else {
var str = event.value;
var n = str.match(/\d/g);
var nw = n.join("");
var num = nw.slice(0, -1);
var numday = str.match(/(\d+)(?!.*\d)/g);
date.setDate(date.getDate() -(Number(num)*7-14+Number(numday)));
this.getField("DG LCC").value = util.printd("dd-mmm-yyyy", date);}

Votes

Translate

Translate
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

I wanted to add that the count from current date 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

So whatever number is in "Terme LCC" that many weeks should calculate?

If yes to above, use this as 'Validation' script of "Terme LCC" field and change "dd-mmm-yyyy" to whichever date format you want:

 

var date = new Date();
if(event.value == "")
this.getField("DG LCC").value = "";
else {
var str = event.value;
var n = str.match(/\d/g);
var num = n.join("");
date.setDate(date.getDate() -num*7);
this.getField("DG LCC").value = util.printd("dd-mmm-yyyy", date);}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

thank you very much.

I'm gratfull for you

it works but I made a mistake

how can I count days also

and how can substract 2 weeks from the resultat   

exemple  the age is 6 weeks + 1 days => date of conception is  25 / 01 / 2022 (from current date)

thanks alot

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

Substract 2 weeks and show that date in "DG LCC"?

6 weeks 1 day, where do you enter those values, please be more specific?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

Un thé same field "DG LCC"

thank you 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

Weeks + days please 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

If you enter "7 SA" (like in your photo) actual date is 5 weeks +1day?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

IF I enter "7 SA +  0 day" Date of conception "DG LCC" is befor 5 weeks + 0 day

if I enter "7 SA +  1 day" Date of conception "DG LCC" is befor 5 weeks + 1 day

if I enter "7 SA +  2 day" Date of conception "DG LCC" is befor 5 weeks 2 1 day

itc ...

thanks

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2022 Feb 22, 2022

Copy link to clipboard

Copied

sory for the last :

if I enter "7 SA +  2 day" Date of conception "DG LCC" is befor 5 weeks + 2 day

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2022 Feb 23, 2022

Copy link to clipboard

Copied

Try this:

var date = new Date();
if(event.value == "")
this.getField("DG LCC").value = "";
else {
var str = event.value;
var n = str.match(/\d/g);
var nw = n.join("");
var num = nw.slice(0, -1);
var numday = str.match(/(\d+)(?!.*\d)/g);
date.setDate(date.getDate() -(Number(num)*7-14+Number(numday)));
this.getField("DG LCC").value = util.printd("dd-mmm-yyyy", date);}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 23, 2022 Feb 23, 2022

Copy link to clipboard

Copied

LATEST

Thanks alot 

you are genius.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines