Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
vchuprina
Specialist
Specialist

How to compare data from different lines

I receive files that contains Style and color information in different lines, in additional they haven't any original part, that I can use to join data. See example below:

 

All Sales Regions  -  CONSIGNMENT PHANTOM.RBK\W255C836A-ONL\L/S TOP CAMDEN
All Sales Regions  - CONSIGNMENT PHANTOM.BLACK
All Sales Regions  - CONSIGNMENT PHANTOM.RBK\W255C946A\L/S TOP THEO
All Sales Regions  - CONSIGNMENT PHANTOM.GREY
All Sales Regions  - CONSIGNMENT PHANTOM.WHITE

How in this case load data correctly(style with necessary color)?

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
1 Solution

Accepted Solutions
swuehl
MVP
MVP

Maybe something like this to get you started:

INPUT:

LOAD *, If( Wildmatch(Line, '*.RBK*'), Subfield( Line, '\',2 ), Peek(Style)) as Style , If( Wildmatch(Line, '*.RBK*')=0, Subfield( Line, '.',2 )) as Color ;

LOAD *, If( Wildmatch(Line, '*.RBK*'), Rangesum( 1, Peek(StyleNo)),Peek(StyleNo)) as StyleNo;

LOAD * INLINE [

Line

All Sales Regions  -  CONSIGNMENT PHANTOM.RBK\W255C836A-ONL\L/S TOP CAMDEN

All Sales Regions  - CONSIGNMENT PHANTOM.BLACK

All Sales Regions  - CONSIGNMENT PHANTOM.RBK\W255C946A\L/S TOP THEO

All Sales Regions  - CONSIGNMENT PHANTOM.GREY

All Sales Regions  - CONSIGNMENT PHANTOM.WHITE

];

RESULT:

LOAD StyleNo, Color, Style

RESIDENT INPUT

WHERE Len(Trim(Color ));

DROP TABLE INPUT;

View solution in original post

6 Replies
settu_periasamy
Master III
Master III

Can you give the sample date with your needed output?

vchuprina
Specialist
Specialist
Author

In output file I should have following:

STYLE                           COLOR

W255C836A-ONL            BLACK

W255C946A                    GREY

W255C946A                    WHITE

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
swuehl
MVP
MVP

Are there any rules how the lines can be deciphered?

Something like .RBK denotes a style? Or lines with \...\ denote a style?

swuehl
MVP
MVP

Maybe something like this to get you started:

INPUT:

LOAD *, If( Wildmatch(Line, '*.RBK*'), Subfield( Line, '\',2 ), Peek(Style)) as Style , If( Wildmatch(Line, '*.RBK*')=0, Subfield( Line, '.',2 )) as Color ;

LOAD *, If( Wildmatch(Line, '*.RBK*'), Rangesum( 1, Peek(StyleNo)),Peek(StyleNo)) as StyleNo;

LOAD * INLINE [

Line

All Sales Regions  -  CONSIGNMENT PHANTOM.RBK\W255C836A-ONL\L/S TOP CAMDEN

All Sales Regions  - CONSIGNMENT PHANTOM.BLACK

All Sales Regions  - CONSIGNMENT PHANTOM.RBK\W255C946A\L/S TOP THEO

All Sales Regions  - CONSIGNMENT PHANTOM.GREY

All Sales Regions  - CONSIGNMENT PHANTOM.WHITE

];

RESULT:

LOAD StyleNo, Color, Style

RESIDENT INPUT

WHERE Len(Trim(Color ));

DROP TABLE INPUT;

vchuprina
Specialist
Specialist
Author

You are right. If lines contains RBK or  '\ \' it's mean that in this line we have style

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").
vchuprina
Specialist
Specialist
Author

Thank you, it works perfectly.

Press LIKE if the given solution helps to solve the problem.
If it's possible please mark correct answers as "solutions" (you can mark up to 3 "solutions").