Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

sql select

hello all,

can you tell if the syntax of the function below is correct ?

Normally i must have in the variable (gvNoOfRowsLastLoad ) at least 1 line  but apparently i retrieve nothing in the database.

when i execute the request in the database i have a data.



LET pSQLWhereClause = 'WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ') ';

sub SrcLoad_LISTE_DATE_APPLI (pSQLTableName,pSQLWhereClause )

  LET gvNoOfRowsLastLoad = 0 ;

  // Load the QVD Table from the SQL table

  LISTE_DATE_APPLI_MODIFIED:

  LOAD DATE_APPLI; SQL SELECT  DATE_APPLI FROM $(gvDBOwner).$(pSQLTableName) $(pSQLWhereClause);

  LET gvNoOfRowsLastLoad = NoOfRows('LISTE_DATE_APPLI_MODIFIED')  ;

  Trace gvNoOfRowsLastLoad : $(gvNoOfRowsLastLoad) ;

  for vRow = 0 to NoOfRows('LISTE_DATE_APPLI_MODIFIED')

  Let MyVar = Peek('DATE_APPLI',vRow-1,'LISTE_DATE_APPLI_MODIFIED');

  CALL srLoad_M2R_DTM_ACKTRANSACTION_INCR( pSQLTableName, MyVar) ;

  next

end sub

Can you help please ?

Regards

5 Replies
Gysbert_Wassenaar
Not applicable

Re: sql select

Check the content of the variables you use. Does LVDateModif have a value? Does pSQLWhereClause get a correct value?


talk is cheap, supply exceeds demand
Not applicable

Re: sql select

yes LVDateModif ='20160810' and yes pSQLWhereClause  get WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ')

Gysbert_Wassenaar
Not applicable

Re: sql select

Well, if pSQLWhereClause resolves to pSQLWhereClause = 'WHERE DATE_APPLI = To_Date(' & CHR(39) & Date(Date#($(LVDateModif),'YYYYMMDD'),'MM/DD/YYYY') & CHR(39) & ',' & CHR(39) & 'MM/DD/YYYY' & CHR(39) & ') ' I'm not suprised your SQL database doesn't understand it. It should resolve to something like WHERE DATE_APPLI = To_Date('08/10/2016', 'MM/DD/YYY'),


talk is cheap, supply exceeds demand
Not applicable

Re: sql select

that's what i get that means i get    --> WHERE DATE_APPLI = ToDate('08/10/2016', 'MM/DD/YYY')

Gysbert_Wassenaar
Not applicable

Re: sql select

Then you have to correct where clause. If your database doesn't like it then you have to figure out what the correct syntax for a where clause is.


talk is cheap, supply exceeds demand