Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
pascos88
Creator II
Creator II

Change field in Table

Hello everyone,

I have a problem.

From the name of a file, I generate the field of the table with SubField.

The name of file is

Pas_Gia_88.qvd

Table1:

Load

SubField(FileBaseName(),'_',1) as Name.

SubField(FileBaseName(),'_',2) as Surname.

SubField(FileBaseName(),'_',3) as Year.

from....

Table 1:

Name        Pas    

Surname   Gia

Year           88

My problem now is that I can't modify the name of the file, and I would like to have 89 for each 88.

My table should not have 88 in this file but 89.

Table 1:

Name        Pas    

Surname   Gia

Year           89

Thanks for any help

Pasquale

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this using Mapping Load

YearChange:

MAPPING LOAD *

INLINE [

Year, NewValue

88, 89

100, 101];

Table1:

Load

SubField(FileBaseName(),'_',1) as Name.

SubField(FileBaseName(),'_',2) as Surname.

Applymap('YearChange', SubField(FileBaseName(),'_',3)) as Year.

from....

Hope this helps you.

Regards,

jagan.

View solution in original post

11 Replies
PrashantSangle

Hi,

try

SubField(FileBaseName(),'_',3) +1 as Year.


Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
pascos88
Creator II
Creator II
Author

Hi Max thanks for the response.

But this was just an exeple, I need to change also other value that aren't not numeric value.

For example a different name.

Michael instead of Pas ..

Do you have some advice?

Regards

Pasquale

jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this using Mapping Load

YearChange:

MAPPING LOAD *

INLINE [

Year, NewValue

88, 89

100, 101];

Table1:

Load

SubField(FileBaseName(),'_',1) as Name.

SubField(FileBaseName(),'_',2) as Surname.

Applymap('YearChange', SubField(FileBaseName(),'_',3)) as Year.

from....

Hope this helps you.

Regards,

jagan.

pascos88
Creator II
Creator II
Author

The right exemple is this

Table1

farm     turbine

A           E1

B           E2

C          E4

C          E2

I don't want name like E1, E2, E4,  but different name like T1, T2, T4

Should be

Table1

farm     turbine

A           T1

B           T2

C          T4

C          T2

E1,E2, E4 come from the name of the file and I can't change this

Regards

Pasquale

jonathandienst
Partner - Champion III
Partner - Champion III

You need to be more specific about what you need to change - preferably with a qvw file containing some representative a data and a clear explanation of the output you would like. You might need a mapping table to make these changes, but it is not possible to be more specific without a lot more information.

Edit - I see you have added some changes. What does this mean:

>>E1,E2, E4 come from the name of the file and I can't change this

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
pascos88
Creator II
Creator II
Author

The right exemple is this

Table1

farm     turbine

A           E1

B           E2

C          E4

C          E2

I don't want name like E1, E2, E4,  but different name like T1, T2, T4

Should be

Table1

farm     turbine

A           T1

B           T2

C          T4

C          T2

E1,E2, E4 come from the name of the file and I can't change this

Regards

Pasquale

PrashantSangle

Hi,

In that case use MAPPING LOAD as suggested by Jagan.

Regards,

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
pascos88
Creator II
Creator II
Author

Hello Jagan,

thanks for response.

In Applymap('YearChange', SubField(FileBaseName(),'_',3)) as Year we don't need specify wich fild sholud be replace with another one?

jagan
Partner - Champion III
Partner - Champion III

Hi,

For changing turbine names try like below

TurbineChange:

LOAD

*

INLINE [

OldName, NewName

E1, T1

E2, T2

E3, T3

E4, T4];

Table1:

LOAD

farm,

ApplyMap('TurbineChange', turbine) AS turbine

FROM DataSourc;

Refer Qlikview help file for more details on this.

Regards,

jagan.