Jump to content
Server Maintenance This Week. ×

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


This topic is 1389 days old. Please don't post here. Open a new topic instead.

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 comment
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 comment
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 comment
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 comment
Share on other sites

This topic is 1389 days old. Please don't post here. Open a new topic instead.

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.