Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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.
Hi,
try
SubField(FileBaseName(),'_',3) +1 as Year.
Regards
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
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.
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
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
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
Hi,
In that case use MAPPING LOAD as suggested by Jagan.
Regards,
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?
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.