Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do i rename these cells in table below

Hello,

I have a table and I want Zenith and Zain in the table below load as ZN. how do I load this table. note that the table is incremental new data and new name are coming.

load * inline[

A, B, C

1, Zenith, 23

2, ECO, 40

3. UBA, 56

4.OCHE, 29

5. YYY, 67

6.RRR, 21

7.Zain, 56

]

1 Solution

Accepted Solutions
puttemans
Specialist
Specialist

Good morning,

Please find attached the working file. You had 2 issues in your script; a datapath that was undefined at the start, and the correct variable not being used in the applymap function.

Kind regards,

Johan

View solution in original post

18 Replies
puttemans
Specialist
Specialist

Hi,

Probably easiest would be to work with a mapping load for those 2 names (you can extend it later to other names as well).

Map_ZN

MAPPING Load * inline [

Name, Newname

Zenith, ZN

Zain, ZN ]

And then finish with a maping load on the B-variable on the data that you add.

Applymap ('Map_ZN', B) as B

Not applicable
Author

am loading from excel and I have to load all the data not only Zenith and Zain

puttemans
Specialist
Specialist

Of course you do. But your initial question was to rename Zenith and Zain into ZN...

Can you attach your script?

chrislofthouse
Partner Ambassador
Partner Ambassador

Do as Johan mentions but use this instead:

Applymap ('Map_ZN', B,B) as B

Not applicable
Author

Its same question not changing the topic. Am loading a set of data from a table and I want to rename two different data into 1, that is why I said the table is incremental

puttemans
Specialist
Specialist

Hello,

I'm not discussing linguistic issues. I'm just trying to help. Now, if you could upload your script, then I can help you 10x faster than right now.

Not applicable
Author

I don't understand you, am loading from QVD . just gave you a scenario

Colin-Albert

Hi Christopher,

You do not need to have B,B in your apply map expression.

If the mapping fails to find a match the original value is returned unless a default value is included.

So Applymap ('Map_ZN', B) as B will return either the mapped value or the data in B


Colin-Albert

Try something like this. The mapping table will be automatically deleted on completion of the load.

Name_Map:

MAPPING Load * inline [

     Name, New

     Zenith, ZN

     Zain, ZN

] ;

Load

     A,

     Applymap('Name_Map', B) as B,

     C

from your_qvd_file.qvd (qvd) ;