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

A Simple Scripting Question

Hi,

While loading the data from a file I have renamed certain fields into common names ( as AGENT_CODE as CODE). Now in case I further want to do some further modifications in the script with the renamed fields, do I need to use the original field name ( AGENT_CODE ) or can I use the new name ( CODE)?

Thanks for the help

1 Solution

Accepted Solutions
Not applicable
Author

hi umang,

the point in your script is that when you rename AGENT_CODE as Code,AGENT_AGE as Age in the load statement,these fields (Code & Age) are not yet created ,they are still being created as newfields(Code & Age) in the load statement. while on the other hand, AGENT_CODE &AGENT_AGE are already there in the table ABC.xlsx from which u are loading these fields. so what u can do is this

tab1:

LOAD
AGENT_CODE as Code,
AGENT_NAME as Name,
AGENT_AGE as Age
FROM ABC.xlsx (ooxml, embedded labels, table is Sheet1);

tab2:

load Code&Age as Unique resident tab;

thanks

View solution in original post

11 Replies
Not applicable
Author

Hello,

by using resident to load the fields or using load before load you have to use the new name (CODE).

The new name is given after finishing loading the table.

Not applicable
Author

Sorry Martin - I could not quite get you

prabhu0505
Specialist
Specialist

I go with Martin, but I guess double 'as' is some typing mistake

( as AGENT_CODE as CODE)

Not applicable
Author

Hi umang,

When u rename the orginal name to new name u should have to use new name.

eg:

AGENT_CODE AS CODE

use renamed field CODE as further change.

Regard's

Naren.

Not applicable
Author

Guys,

Maybe I could explain my problem. Below is my script

LOAD
AGENT_CODE as Code,
AGENT_NAME as Name,
AGENT_AGE as Age,
Code & Age as Unique
FROM ABC.xlsx (ooxml, embedded labels, table is Sheet1);

When I concatenate Code & Age, QV gives me an error but if i use AGENT_CODE and AGENT_AGE then the same works perfectly.

Is there some by which I can use Code & Age rather than the original names

Not applicable
Author

hi umang,

the point in your script is that when you rename AGENT_CODE as Code,AGENT_AGE as Age in the load statement,these fields (Code & Age) are not yet created ,they are still being created as newfields(Code & Age) in the load statement. while on the other hand, AGENT_CODE &AGENT_AGE are already there in the table ABC.xlsx from which u are loading these fields. so what u can do is this

tab1:

LOAD
AGENT_CODE as Code,
AGENT_NAME as Name,
AGENT_AGE as Age
FROM ABC.xlsx (ooxml, embedded labels, table is Sheet1);

tab2:

load Code&Age as Unique resident tab;

thanks

Not applicable
Author

Thanks tauqueer,

but in this case the two tbas would be seperate and would not be associated with each other right?

Not applicable
Author

I got it just need to do take a common field in the new tab and do a join to merge the two sets thanks

Not applicable
Author

hi umang,

u can do a left join

tab1:

LOAD
AGENT_CODE as Code,
AGENT_NAME as Name,
AGENT_AGE as Age
FROM ABC.xlsx (ooxml, embedded labels, table is Sheet1);

left join (tab1)load Code&Age as Unique resident tab;

thanks