Jump to content

script to extract data from a field and paste it into another field


Recommended Posts

It is possible only if there are some rules that one could use for such extraction. Looking at the examples given in your file, I am not able to formulate any rule that would fit all of them, except perhaps one: it seems that the first group of consecutive digits is the numerical value of the volume or the weight. But then it gets complicated, because sometimes there is a space between the digits and the unit and sometimes there isn't. And no computer is smart enough to recognize that ml is a unit of volume while gr is a unit of weight without having a lookup table of all possible units to consult.

Anyway, I would start by looking at the position of the first digit in the given text and make a split there. Then see what you can do with the extracted tails:

330 ml
330ml
400 gr
210 g (20 pcs)
220gr
30ml 8 pcs

BTW, this seems like one of the relatively rare cases where using regex (with the help of a plugin) might be a good idea.

 

Link to post
Share on other sites

You keep giving me examples, when I ask for rules. I can make up rules that will fit your two examples, but they may not fit the next one.

 

Link to post
Share on other sites

Unfortunately, I don’t have such a plugin to solve my issue, that’s why I simplified the task in order to get a simple solution. 

Link to post
Share on other sites

I am afraid you keep confusing between what and how. First, we need to figure out what we want to do. Then, and only then, comes the question of how to do it. So far, I am not sure what exactly you want to do here. The plugin is in the "how" category. And if you want to use regex, you can use the free BaseElements plugin. 

 

Link to post
Share on other sites

since regex is free, I suggest we continue with the first example. 

So, how regex can help here?

Link to post
Share on other sites

How is the data initially inputted, import?  Seems like forcing the user to put the type of measurement in when entering thru a dropdown (if possible) is the easier way to go.

Link to post
Share on other sites

impo

38 minutes ago, Steve Martino said:

How is the data initially inputted, import?

import from Excel spreasheet

 

39 minutes ago, Steve Martino said:

Seems like forcing the user to put the type of measurement in when entering thru a dropdown (if possible) is the easier way to go.

Yeah, maybe

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.