Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

problems with query for datefield = 2015

Hi there,

i am new to qv and i hope you can help me again.

I want to write in a SQL Table like:

write_table:

LOAD

        Ratenschema,

        lieferant as lieferant_1,

        reason as reason_1,

        AVG(Erlös / cost) as faktor1,

        AVG((DB_neu + Erstattung) / cost) as faktor2,

        Datum_Datenbank as datum_test

       

resident write_faktor

WHERE

        YEAR(Datum_Datenbank) = 2015

GROUP BY

        Ratenschema,

        lieferant,

        reason,

        Datum_Datenbank;

For i= 0 to NoOfRows('write_table') -1

    LET V_FIELD1 = peek('Ratenschema',$(i),'write_table');

    LET V_FIELD2 = peek('lieferant_1',$(i),'write_table');

    LET V_FIELD3 = peek('reason_1',$(i),'write_table');

    LET V_FIELD4 = peek('faktor1',$(i),'write_table');

    LET V_FIELD5 = peek('faktor2',$(i),'write_table');

    LET V_FIELD6 = peek('datum_test',$(i),'write_table');

    SQL INSERT INTO dba.faktor_ratenschema VALUES(NULL, '$(V_FIELD1)', '$(V_FIELD2)', '$(V_FIELD3)', replace('$(V_FIELD4)', ',' , '.')  , replace('$(V_FIELD5)', ',' , '.') , '$(V_FIELD6)');

NEXT;

But the restriction for the year doesnt work!

Any idea how to input data from year 2015 into the database?

Thanks and regards

Sabrina

18 Replies
Not applicable
Author

the first and the second idea doesn't work and the third is still running...

buzzy996
Master II
Master II

are u tried tis way?

Year(Date(Datum_Datenbank,'YYYY-MM-DD'))=2015


with out #.

Not applicable
Author

Yes, did it! But nothing works...

buzzy996
Master II
Master II

can u create a text object on ur sheet with tis expression and let me know what is the output ur getting?

anbu1984
Master III
Master III

What do you mean by doesn't work? Is it fetching all data or nothing?

Can you try below expr in Load statement and check the result instead of mentioning it in where clause?

Year(Date#(Datum_Datenbank,'YYYY-MM-DD'))

anbu1984
Master III
Master III

If nothing works, can you post QVW with sample data using below statement?

Load * From Qvd.qvd(qvd) Where RecNo() < 10;

Not applicable
Author

try this one:

Year(Date#(Datum_Datenbank,'YYYY-MM-DD'))=Year(Date#(Today(),'YYYY-MM-DD'))


sorry takeout the hash


Year(Date(Datum_Datenbank,'YYYY-MM-DD'))=Year(Date(Today(),'YYYY-MM-DD'))


and also the below seems to work for me too.


Date(Datum_Datenbank,'YYYY'))=Date(Today(),'YYYY'))

Not applicable
Author

subfield(Datum_Datenbank,'-',1)=2015

is the solution!

Thank you so much!!!!!

Not applicable
Author

subfield(Datum_Datenbank,'-',1)=2015

is the solution!

Thank you so much!!!!!