Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Guys, I need your help..
How to write script for edit record on QVD?
for example:
Update table_a
set Map_2='Other'
where Map_2='Opex'
Thank before.
Hi,
Try this
Table_a:
Load
Cost_Centre, Periode_Report, Amount,
if(match(Periode_Report,'201311','201312','201401','201402','201403')
and Match(Cost_Centre,'S812','S813')
and Map_1 <> 'Expense'), 'Other',Map_1) as Map_1,
if(Match(Periode_Report,'201311','201312','201401','201402','201403')
and Match(Cost_Centre,'S812','S813')
and Match(Map_2, 'OPEX'), 'Other OPEX',Map_2) as Map_2
Regards,
jagan.
Hi,
You cannot directly update a QVD instead you need to recreate it again like this
Data:
LOAD
Field1,
Field2,
If(Map_2 = 'Opex', 'Other', Map_2) AS Map_2
FROM QVDFileName.qvd;
STORE Data INTO QVDFileName.qvd;
Hope this helps you.
Regards,
Jagan.
Hi Valdi, there is direct way to edit the record in the QVD.
First you have to load the QVD and edit the record withe ApplyMap or LookUp or If condition. I personally use ApplyMap because its relatively very fast.
First create the Mapping Table with your edit field values.
MAP_EDIT:
MAPPING LOAD * INLINE [
Map_2, Map_2_New
Opex, Other
Opex1, Other1
];
QVDNAME:
LOAD A, B, C, ApplyMap('MAP_EDIT', Map_2 , Map_2) AS Map_2
From QVDNAME.qvd (qvd);
STORE QVDNAME into QVDNAME.qvd (qvd) ;
DROP Table QVDNAME ;
how to edit record for example:
Data:
LOAD
Field1,
Field2,
If(Map_2='OPEX','OTHER',MAP_2) as MAP_2
from QVDFileName.qvd
store Data into QVDFileName.qvd
and I want to keep data 2013, and just data 2014 has changed?
Hi,
Try like this
Data:
LOAD
Field1,
Field2,
If(Year(DateFieldName) = Year(Today()) AND Map_2 = 'Opex', 'Other', Map_2) AS Map_2
FROM QVDFileName.qvd;
STORE Data INTO QVDFileName.qvd;
Replace DateFieldName with your date field name.
Hope this helps you.
Regards,
Jagan.
Can You give me write example Year Date?
Data:
Load
Field1, Field2, If (Year(DatePeriode_Report)=Year(Today())) and Map_2='Opex','Other',Map_2) as Map_2 ?
Record Periode Report='2013011','2013012','2014001','2014002','2014003'
how to write the scrip for YearDate?
Hi,
Can you attach some sample data and expected output? or try this
Load
Field1, Field2, If (Left(DatePeriode_Report, 4)=Year(Today())) and Map_2='Opex','Other',Map_2) as Map_2
FROM QVDFileName.qvd;
STORE Data INTO QVDFileName.qvd;
Regards,
Jagan.
Great,
Thank you Mr.Jagan Mohan.
Regards.
Hi,
Please close this thread by clicking Correct and Helpful Answer buttons to the posts. It helps others in finding the answers for similar requirement.
Regards,
Jagan.
Mr. Jagan,
I'm sorry, I have the last question. how to write script if
Map_3=('Depreciation','Fixed Assets','GA Exp'),'Other',Map_3) as Map_3? <<-- is it true?
I want to edit 3 differrent record ('Depreciation','Fixed Assets','GA Exp') to 'Other' furthermore Map_3
Thanks before.