Covert YYYY-MM-DD date to Letter for Month, Jan=A, Feb=B, March=C etc S’abonner

0
Avatar
C_S

Hi there,

I've found this thread which essentially the same thing I'm trying to do however, more specifically I'm trying to take a date entered from a Date Picker on a Data Entry Form and convert it to the Letter for the month, such as Jan=A, Feb=B, March=C etc and then ideally add YY to the end of it. In other words, for January 2020, the value would be A20.

I know I can create a separate dropdown on the Data Entry form to create the A/B/C values that way, but I would prefer to only have the operator choose one date to reduce risk of a mismatch between Month and the date selected from the Date Picker. The date from the Date Picker is also being dragged into a GS1 UDI so I need the YYYY-MM-DD format to come through for that purpose.

Any ideas?

3 commentaires

0
Avatar
Pete Thane
Actions pour les commentaires Permalien

Hi,

The VB script below should work. It should be set as an Event Controlled>OnPostPrompt script routine.

I have given the substring that is linked to the Date Picker a name, datechosen, and that is referenced in the first line of the VB and have also made the label field that outputs the converted string a separate field to that used to enter/select the date

Pete  

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

Value1 = Month(Value)

Value2 = Year(Value)

Value1 = Mid("ABCDEFGHIJKL", Value1, 1)

Value2 = Right(Value2,2)

Value = Value1 & Value2

0
Avatar
C_S
Actions pour les commentaires Permalien

Pete,

Thank you so much. That was exactly what I was looking for and does the job when printed.

One thing however, it doesn't pull in the YY data in real-time so the barcode in the designer shows as K instead of K20 for example (see below). While not a problem, it might be confusing for someone down the road. What would I need to modify the above code so that it showed A and printed A, and then I can just add the YY back in via another data source. In other words, so I can make the real-time barcode correct.

0
Avatar
Pete Thane
Actions pour les commentaires Permalien

 

What do you mean by viewing the barcode in real-time? Is it when you open the label and see it on the screen in Designer or Print Station r some other time? 

Vous devez vous connecter pour laisser un commentaire.