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

Date to ddmmyyyy format with extra added text

Explorer ,
Apr 26, 2023 Apr 26, 2023

Copy link to clipboard

Copied

Hi 

My scenario is this. I am making batches of medicine - lets call it MED 

I can make multiple batches per day (i.e. batch 1, 2, 3) 

I would like an identifier to identify which batch of MED it is.

I want the user to select the date of production in one cell (e.g. 27/04/2023) and automatically fills the other cell with the batch number in the format of (20230427-MED-n) where n is 1,2,3 and can be edited by the user. 

Is this possible? 

TOPICS
JavaScript , PDF forms

Views

1.1K

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 1 Correct answer

Community Expert , Apr 26, 2023 Apr 26, 2023

Use something like this as 'Validate' script in 'Date' field:

var str = event.value;
var s = str.split("/");
if(event.value)
this.getField("Text2").value = s[2]+s[1]+s[0]+"-MED-n";
else
this.getField("Text2").value = "";

Just change "Text2" to the name of the field where you want to show that text.

Votes

Translate

Translate
Community Expert ,
Apr 26, 2023 Apr 26, 2023

Copy link to clipboard

Copied

Use something like this as 'Validate' script in 'Date' field:

var str = event.value;
var s = str.split("/");
if(event.value)
this.getField("Text2").value = s[2]+s[1]+s[0]+"-MED-n";
else
this.getField("Text2").value = "";

Just change "Text2" to the name of the field where you want to show that text.

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
Explorer ,
May 03, 2023 May 03, 2023

Copy link to clipboard

Copied

LATEST

Thanks Nesa. You're amazing! Saved me once more!

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 ,
Apr 26, 2023 Apr 26, 2023

Copy link to clipboard

Copied

It would be possible but you would need to enlist the help of a javascript author to make it happen. You would need to consider how the 1,2,3 are differentiated. 3 different files?

 

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