Jump to content

Saving only the unique records?


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

Recommended Posts

Hi- Here is an example that makes more sense than my last question.

I have 10 records and each record has a field called "color."

The records are entered to tell the color of Pens sold.

The 10 were entered as follows:

Black

Green

Red

Blue

Blue

Blue

Black

Red

Purple

Yellow

Although there are 10 different records. I need to find out only those originals and not the duplicates. and have it that result sent to another file "originals" into a field called

"SaleColors"

The result would be Black, green, red, blue, purple , yellow

I am trying to figure out how to script that.

Thanks

Dave

Link to comment
Share on other sites

Another method:

1. Create a Value List based on your field, "color". Call it "colors".

2. Create a global text field to hold the list of unique colors. Call it "g_colors".

3. Create a script with the following step:

Set Field [ g_colors, Substitute(ValueListItems(Status(CurrentFileName), "colors"), "

Link to comment
Share on other sites

Queue ...

Thanks.

I'm embarassed to show anyone the first solution I came up with! It was similar to yours, but more complicated. I don't know why after spending an hour doing up that solution, which had 3 scripts and about 6 fields, the ValueListItems idea just plowed right to the front of my brain smile.gif

Weird how that works.

Link to comment
Share on other sites

Hey, it's okay. My first thought is usually 'repeating fields and ValueListItems'. Then I go off for a while testing all sorts of crazy ideas. Often it's productive, like that variable day of year file I posted a couple of weeks ago (which I think disappeared during the server hack). But I'd probably still be working on a complicated demo for this solution, if 'self-join' hadn't cut its way to the front of my brain queue first. wink.gif

Link to comment
Share on other sites

Well now! Isn't it just like guys to complicate things. smile.gif

Create a columnar report. Place the field in a leading sub-summary plus any fields you want to export). Nothing in the body. Sort by this field (important). Select Export then export Summarize By only (this field). You will get one of each color exported.

Or am I still asleep? grin.gif

LaRetta

Link to comment
Share on other sites

Hi LaRetta ...

Yah, but he wants the output in a field, separated by commas, not in a report ...

Quote:

"Although there are 10 different records. I need to find out only those originals and not the duplicates. and have it that result sent to another file "originals" into a field called "SaleColors" The result would be Black, green, red, blue, purple , yellow"

and that's exactly what we gave him.

"Ours is not to question why, ours is but to do and die."

LOL

Link to comment
Share on other sites

Hmm, well I suggest you try it. It works. You can export in any format you wish and you will receive one each unique color. It's a trick I learned from Andy Gaunt. smile.gif

I'll bet you don't ask for directions either!!! wink.gif

BTW, if you all haven't downloaded his new eBullet demo, you're blowin it! It's can be downloaded at:

FusionDZine!!!

I've been working with it and it's incredible!

LaRetta

Link to comment
Share on other sites

Okay, sorry! I didn't see 'send to another file into one field' and thought only an export of unique was needed to 'send to another file.' crazy.gif

Major break needed, I think. I'm glad you got it resolved. wink.gif

LaRetta

Link to comment
Share on other sites

Hi again

I tried this same formula with a great big file with 4500 records. It didn't put the unique items in the global field at all. Is that because there are too many items?

Set Field [ g_colors, Substitute(ValueListItems(Status(CurrentFileName), "colors"), "

Link to comment
Share on other sites

So it worked on a small set, but not on a larger one ?

I guess the "color" stuff was just an example to get you started. What exactly is the field and data you're trying to catch.

I would be surprised that you've crossed FM limitations in a text field.

Check back your formula. Is you Value list name equal to what is into the quotes ?

Link to comment
Share on other sites

Here's a demo file that creates 5000 records and assigns one of 15 random colors to each.

Follow the instructions on the Entry layout.

The "get_unique_colors" script inserts a comma separated list of the unique values in the color field into the g_colors global.

Unless I don't understand exactly what you are trying to do, the procedure seems to work fine.

Ugo: Yes .. I think you'd need a LOT of colors to hit the 64,000 character limit for the g_colors global. smile.gif And, good point about checking the Value List name in the formula in the script step. grin.gif

NonDuplicate_List demo.fp5.zip

Link to comment
Share on other sites

  • 1 month later...
  • Newbies

hai,

i have a small problem.....

like i have a file which have employee information of Name, user Type, Manager

this manager is also a employee...

basically the user types are defined list as (SuperAdmin, Admin, Manager)

i have record like the below

Name ---- UserType ---- Manager

SP - SuperAdmin - SP (this user is a power user... him self a manager)

A1 - Admin - SP

A2 - Admin - SP

A3 - Admin - SP

M1 - Manager - A1

M2 - Manager - A2

M3 - Manager - A1

when i am creating the users..... there i need a list where if user type is SuperAdmin the manger list will have only SP(the SuperAdmin UserName)

and if the user type is Admin then in manager list will have only SP (While admin will under the SuperAdmin User

and when user type is manager... the list all the Admin User type UserNames

like the example (A1,A2,A3)

Pl help me in this......

Thanks

Prasad Anu

Link to comment
Share on other sites

  • Newbies

hai,

i have a small problem.....

like i have a file which have employee information of Name, user Type, Manager

this manager is also a employee...

basically the user types are defined list as (SuperAdmin, Admin, Manager)

i have record like the below

Name ---- UserType ---- Manager

SP - SuperAdmin - SP (this user is a power user... him self a manager)

A1 - Admin - SP

A2 - Admin - SP

A3 - Admin - SP

M1 - Manager - A1

M2 - Manager - A2

M3 - Manager - A1

when i am creating the users..... there i need a list where if user type is SuperAdmin the manger list will have only SP(the SuperAdmin UserName)

and if the user type is Admin then in manager list will have only SP (While admin will under the SuperAdmin User

and when user type is manager... the list all the Admin User type UserNames

like the example (A1,A2,A3)

Pl help me in this......

Thanks

Prasad Anu

Version: Developer v6

Platform: Windows 2000

Link to comment
Share on other sites

This topic is 6524 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
 Share

×
×
  • Create New...

Important Information

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