Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi I am getting some data in flat file in the given format and i want to load these data in a tabular format with two columns Say used % and Description
if the usage % is 100 then there will not be any other line but if its lesser then it will show the components which are not being used .
so i want to capture the usage % in used % colum and component in description
Hi,
Try this:
DATA:
LOAD
Usage%,
If(Usage%=100,null(),Description) as "Description"
Inline [
Usage%, Description
100, XXX
98, YYY
];
hi The file may not be static and values may change but data will be same format ...i need to load dyanically using transformation
Hi,
Try this script
Data:
LOAD DISTINCT *;
LOAD
If(WildMatch(@1, 'Usage*'), Trim(SubField(@1, '=', 2))) AS Usage,
FileName() AS FileName
FROM
[SAMPLE*.txt]
(txt, codepage is 1252, no labels, delimiter is '\t', msq)
WHERE WildMatch(@1, 'Usage*');
LEFT JOIN(Data)
LOAD
If(NOT WildMatch(@1, 'Usage*', 'The following components*'), @1) AS Component,
FileName() AS FileName
FROM
[SAMPLE*.txt]
(txt, codepage is 1252, no labels, delimiter is '\t', msq)
WHERE NOT WildMatch(@1, 'Usage*', 'The following components*');
DROP FIELD FileName;