7 Day Due Date...? フォローする

0
Avatar
Milo Velasco

hi. how can i make a 7-day due date from date of prod. date? what i would like to happen, every time we change the prod. date, it automatically calculate its 7-day due date. we're using bartender version 10.0 sr4 automation edition.

 

thank you. 

13 コメント

0
Avatar
Pete Thane
コメントアクション Permalink

In later versions (possibly from 10.1 onwards) there is a way to do this fairly simply with an offset option in the More Options/Transforms screens but I dont believe this is present in v10.0 and so you will need to use some VB Script.

  1. For ease make your Production Date field a named data source (I called mine ChooseDate in the code below)
  2. For your Due Date, amend the filed to VB Script field or the Event Controlled sub-type and then Edit the script via the button
  3. In the AutoSelectedEvent change the value to          Value = Now()
  4. Next click on the OnPostPrompt option and add the following

Value = Format.NamedSubStrings("ChooseDate").Value

Value = DateAdd("d",7,Value)

(To enter the FormatNamedSubString..... entry, do not type this is but type "Value = " and then double click on the name of your field entered in 1. above from the Named Sub-Strings options which I believe can be found in the bottom right of the VB are in 10.0)

 

 

0
Avatar
Milo Velasco
コメントアクション Permalink

Hi Peter.

Thank you for your reply. Sorry but I am lost staring from step 2. I am not really well verse with VB Scripts. Here are some screen shots of what I've done. 

 

0
Avatar
Pete Thane
コメントアクション Permalink

For point 1 you need to leave your Production Date field as it was apart from give it a name and then exit out of that field and edit the Due Date field.

The Due Date needs to be the Event Controlled Field and needs to be amended as in 3 and 4 above.

Looking at your screenshots, for 4 however the process is slightly different and in the Script for OnPostPrompt box type (on a new line)

Value = 

then click on the Shared Data Sources in the Category box to the bottom right as I think this is where the name for the Production Date will be found. Double click on and this will add after your Value = . NOTE: If the name is not appearing in the Shared Data Sources then it could be in BarTender Objects, it has been a long time since I have used v10.0 and so I cannot remember where the Named Data Sources are displayed.

Next add the Value = DateAdd.... line as above to finish the script

 

0
Avatar
Milo Velasco
コメントアクション Permalink

Hi Peter!

Thank you for your prompt reply. 

I was able to follow your instruction but it seems its not working. Looks like I've missed something or done something wrong somewhere down the line. Should I leave the "Data Type" on Text? On the OnPostPrompt, when I double click on the "Prod_Date" from Category > Name, it doesn't change anything on this script "Value = Format.NamedSubStrings("Prod_Date").Value. It doesn't change this > Format.NamedSubStrings.

Here are some screen shots again starting from step 2.

 

 

Thank you once again. 

0
Avatar
Pete Thane
コメントアクション Permalink

Everything looks okay, but I am guessing you may not be using a Prompt screen to enter the date but could be changing this on the label itself and so the VB may not be triggering.

Cut and paste the VB code from the OnPostPrompt and instead add it to the OnIdenticalCopies and see what that does.

Pete

0
Avatar
Milo Velasco
コメントアクション Permalink

Thanks Peter for a quick response.

Still no success.

0
Avatar
Pete Thane
コメントアクション Permalink

As per your earlier message above for the Due Date field change the Type to Date and select the way you want the date to appear and this will get rid of the time. The due date calculation will only work when you actually print the label or print preview and not show up on the screen.

0
Avatar
Milo Velasco
コメントアクション Permalink

Thanks again Peter. I'll try it later. What about this scrip > Value = Format.NamedSubStrings("Prod_Date").Value. When I double click the Name from the Category, it never replaces this > Format.NamedSubStrings.

0
Avatar
Pete Thane
コメントアクション Permalink

The Format.Named.... is correct as that is the "flag" to call up the data entered into Prod_Date to use as the base value.

We may need to go back a step I think.

For the production date, how it that entered? Typed in on the label, or linked to today's date (dont think it can be as it hasn't changed) or entered via a DataEntry Form with a Prompt at Print Time field?

0
Avatar
Milo Velasco
コメントアクション Permalink

Hi Peter!

Sorry for the late reply. Just my 1st day at work again coming from a 4-days off.

I think I'm almost there. You're right, the 7-days can only be seen during preview and on the printout. I'm just getting an error which I don't know what is that.

 

 

 

 

This is the error after clicking the preview button.

 

This is the preview. It computed the 7-days from Production Date.

 

Thank you once again.

0
Avatar
Pete Thane
コメントアクション Permalink

I believe that error relates to a picture/image item that you have on your Data Entry Form, but that is not linked to any field on your label. It is not connected with the VB scrtipt. 

0
Avatar
Milo Velasco
コメントアクション Permalink

Hi Peter!

Does it mean that I'm good now with this and have been sorted out already? 

0
Avatar
Pete Thane
コメントアクション Permalink

You should be once you have corrected the image issue mentioned above

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