Auto Date 4 Months In Advance Of Manu Date フォローする

0
Avatar
Legacy Poster

Hi guys hope you're all well.

 

I was wondering if someone could help me with a dilemma.

 

I have a label that displays used by dates of product in a gift we sell.

The user will add the the date of manufacture from a drop down on the prompt.

 

My question is, how do I get a 4 month sell by date to appear on the used by area on the finished label?

Iv managed to set it up so It projects 4 months from today's date, the only problem with that is some product are made on different days. I really need the script to take the 4 month on point from the value chosen in the drop down.

 

I've attached a couple of screen shots to show what i mean, the expiry date area has a red box around it.

 

Thanks in advance 

Chris  :)

11 コメント

0
Avatar
Legacy Poster
コメントアクション Permalink

Hi Chris,

 

I take it from the images that you aren't running BT2016 as there is a simple way to offset dates in that version and so you will need to use the DateAdd function to add the 4 months onto the Production Date of each product. It looks like these would need to be set as Event Controlled Post Prompt scripts too.

 

There is a bit on info in this forum question which may help.

 

http://forums.seagullscientific.com/index.php?/topic/5256-vbscript-using-today-and-db-month-field/

0
Avatar
Legacy Poster
コメントアクション Permalink

Hi Pete.

I'll check it out.

 

Thank you very much for your help.

 

Chris

:D  

0
Avatar
Legacy Poster
コメントアクション Permalink

Good morning Pete.
 
I'm still having trouble getting my head around this, please excuse my ignorance.
 
My data source is named "DATE1" so with that in mind would my VBs read ...
 
Value = DateAdd("m", "4", ("DATE1"),Date)
 
As i say, please forgive my lack of knowledge on this, up until now the need for more complicated script hasn't been there.
 
(Needless to say iv put in a request for a copy of BT2016)  :rolleyes:
 
Many thanks 
Chris 
0
Avatar
Legacy Poster
コメントアクション Permalink

Hi Chris,

 

You do not need the ".." round the 4 for the months and to select the DATE1 you need to click on the Named Sub-Strings option at the bottom left of the VB screen and then double-click on the DATE1 to add it correctly so you should end up with something like 

 

Value = DateAdd("m",4,Format.NamedSubStrings("DATE1").Value)

 

I hope that helps

 

Pete

0
Avatar
Legacy Poster
コメントアクション Permalink

Thanks for all your help on this Pete.

 

ok so iv done all that and this is what i have...

 

Value = DateAdd("m",4,Format.NamedSubStrings("DATE1") 

 

 

 

Unfortunately im getting an error message now thought...

 

<Line 1: Value = DateAdd("m",4,Format.NamedSubStrings("DATE1" : Expected ')'>

 

 

Again, thank you Pete.

:)

0
Avatar
Legacy Poster
コメントアクション Permalink

There needs to be a closing ) at the end of the string

0
Avatar
Legacy Poster
コメントアクション Permalink

Hey Pete.

 

Thank you for your patience  :s

 

I'm now getting a rather unhelpful script error.

 

<Line 1: : Unknown script error.>

 

lol .... I'm going to give this one more try then i think ill twist my IT departments arm a bit more for BT2016 

 

 

Thanks in advance Pete, you've been an absolute star !

Chris 

 

:D

0
Avatar
Legacy Poster
コメントアクション Permalink

Hey Pete.

 

Good news.... I have BT2016

 

Do you have a link explaining the DateAdd function you mentioned?

 

Many thanks 

Chris 

0
Avatar
Legacy Poster
コメントアクション Permalink

Hi Chris,

 

You can find some information about the DateAdd function in the VB area's Help section, however the attached sample should put you on the right track I hope.

 

You will need to give each of the Products on your label a different "name" and add a VB field for each BBE date, adjusting the VB to look for the appropriate "name" add the 4 months onto.

 

Pete 

0
Avatar
Legacy Poster
コメントアクション Permalink

Pete, this is amazing!

 

Thank you very, very much for all you're help on this.

 

You're a star !!!

 

 

All the best,

Chris   :D  :D  :D

0
Avatar
Legacy Poster
コメントアクション Permalink

Hey Pete.

 

Just wondering if you might know why this is happening....

 

I change the date input method to a drop down list. This was so I could use the label template on PC running an older version of BT.

 

I managed to link a spread sheet with dates to the drop down, I then adapted everything from that point on so the dates were off set by 4 months. Everything works fine in CT2016.

 

However, if I open the template in an older version of BT and try to run it it throws up an error message.

 

#3904

<line 2 : : Type mismatch: '[string: ""]'>

 

Have you ever seen this before ?

 

Thanks very much 

Chris 

ログインしてコメントを残してください。