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

Store data

Hi guys,

I receive files with data in different sheet, see below name of columns in the first sheet

ModelCodeColorSizeSalesPrice

and second

ModelCodeColorSales STDPrice

They have four columns with the same name.

Could you please advise how can I load data in one output.

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").
6 Replies
Not applicable

The best approach is talk to source of file creator why they generated the filed names differently. Try to correct field names discrepancy on their end.

Otherwise, you have manually create Field Names Mapping table & use the Rename Fields using Mapping method.

The Field Names mapping should be maintained by you manually or Look for other options how to automate the creation of Field names mapping.

vchuprina
Specialist
Specialist
Author

Thank you for response.

In output I want to see following columns with data.

Model       Code       Color       Size       Sales       Sales STD      Price

So is this possible to put data in one output if tables have different columns number and different data in columns, for example: first sheet doesn't contain 'Size' column, but has 'Sales STD' and second sheet conversely.

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").
Not applicable

Are trying to join the these data files ?

Not applicable

Please provide the sample data & desired o/p so community can help you.

Not applicable

I'd recommend keeping "Code" in both tables and don't load "Model" and "Color" from one of the tables because if my guess is right, it is redundant data.

1st table:

ModelCodeColorSizeSalesPrice

2nd table:

ModelCodeColorSales STDPrice

The field "Code" will link the data from both tables.

vchuprina
Specialist
Specialist
Author

Ok. As i said before data comes in one file. Usually files have two sheets one with Last Week data (Sheet 1) and one with STD data (Sheet 2).

So I should create third table that will be contains all columns?

See my script below:

IF( WildMatch(Upper(vSheetName), '*Sheet2*') AND NOT WildMatch(vSheetName,'*WEEK*','*database*', '*_xlnm*') ) THEN

DataLW:

LOAD

FileName() as FILE_NAME,

     '$(vSheetName)' as SHEET_NAME,

     Date(SubField('$(vWKEND)',':',2),'YYYY.MM.DD') AS WEEK_ENDING_DATE,

     SubField('$(vSeason)',':',-1) AS SEASON,

     Model AS STYLE,

     Colour AS COLOR_DESC,

     Size AS SIZE,

     [Sales, pcs] AS SLS_U,

     [Price, €] AS CURRENT_PRICE

FROM

[$(vFile)]

(biff, embedded labels, header is $(vRowStart) lines, table is [$(vSheetName)$])

Where Size <> ''

;

ELSE


DataSTD:

LOAD

FileName() as FILE_NAME,

     '$(vSheetName)' as SHEET_NAME,

     Date(SubField('$(vWKEND)',':',2),'YYYY.MM.DD') AS WEEK_ENDING_DATE,

     SubField('$(vSeason)',':',-1) AS SEASON,

     Model AS STYLE,

     Colour AS COLOR_DESC,

     pcs AS SHIPMENTS_U,

     pcs1 AS STD_SLS_U,

     [€] AS CURRENT_PRICE

FROM

[$(vFile)]

(biff, embedded labels, header is $(vRowStart) lines, table is [$(vSheetName)$])

Where IsNum(€)

;

ENDIF

ENDIF


NEXT

Drop Table Temp_Tables;

NEXT

STORE ....

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").