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: 
Anonymous
Not applicable

replacing a field value with 'n' of coulmns

My target is to eliminate 'N/A' and repalce with  'NO'

I almost got the script with logic but somewhere    "J" is taking wrong values instead of 18.


Advise me modifications or new lines ...

************************************************************************

SOURCE:

LOAD Q1,

     Q2,

     Q3

FROM

[.......................................]

(ooxml, embedded labels, table is Sheet2);

LET Vreplace='OK';

LET VCOLNO = NoOfFields('SOURCE');  // Countng number of columns

  FOR I = 1 TO  NoOfFields('SOURCE') //

  let vFieldname=0;

  let vFieldname = Fieldname($(I),'SOURCE'); //

         for J = 1 to FieldvalueCount('$(vFieldname)')  // Getting in to each column(field).

           IF(FieldValue('$(vFieldname)',$(J))='N/A') then //searching in each Feild....

                    SignificantRecords:

                          LOAD

                       FieldValue('$(vFieldname)',$(J))='NO' as newvalue;

            End if;   

               

         next J

   //Let vNumRecords =0;

   next I    

LET VCOLNO=0;

//*******************************************************************************

3 Replies
sunny_talwar

Anonymous
Not applicable
Author

Could you please help me understand why you are not using Replace function ie Replace(s, fromstring ,tostring)

Clever_Anjos
Employee
Employee

>>My target is to eliminate 'N/A' and repalce with  'NO'.

Do you want to keep same columns and rows?

Maybe you want to try this:

Map:

Mapping LOAD * Inline [

  From, To

  N/A, NO

];

MAP Q1,Q2,Q3 using Map;

SOURCE:

LOAD Q1,

    Q2,

    Q3

FROM

[https://community.qlik.com/servlet/JiveServlet/download/1135616-248083/SURVEY.xlsx]

(ooxml, embedded labels, table is Sheet2);