
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Peek with date value
Hi,
Can someone please explain why Peek function has to be used with date to get its value into a variable.
I know the general purpose of Peek function but couldn't understand why is it used to extract date value into a variable.
Also, although date variable is getting extracted correctly, nothing is getting loaded into my final table tab3.
Tab3 must have same data as Tab1
tab1:
load * Inline
[Dat, Countr, Produc, Amoun
2022-01-20, Canada, Washer, 6
2018-07-08, Germany, Anchor bolt, 10
2018-07-14, Germany, Anchor bolt, 3
2018-08-31, France, Nut, 2
2018-09-02, Czech Republic, Bolt, 1
2019-02-11, Czech Republic, Bolt, 3
2019-07-31, Czech Republic, Washer, 6
2020-03-13, France, Anchor bolt, 1
2020-07-12, Canada, Anchor bolt, 8
2020-09-16, France, Washer, 1]
tab2:
load max(Dat) as maxdate resident tab1;
let vmaxdate=Peek('maxdate');
trace $(vmaxdate);
tab3:
load * resident tab1 where Dat<$(vmaxdate);
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use NoConcatenate and drop the first table.
tab1:
load * Inline
[Dat, Countr, Produc, Amoun
2022-01-20, Canada, Washer, 6
2018-07-08, Germany, Anchor bolt, 10
2018-07-14, Germany, Anchor bolt, 3
2018-08-31, France, Nut, 2
2018-09-02, Czech Republic, Bolt, 1
2019-02-11, Czech Republic, Bolt, 3
2019-07-31, Czech Republic, Washer, 6
2020-03-13, France, Anchor bolt, 1
2020-07-12, Canada, Anchor bolt, 8
2020-09-16, France, Washer, 1];
tab2:
load max(Dat) as maxdate resident tab1;
let vmaxdate=Peek('maxdate');
trace $(vmaxdate);
NoConcatenate
tab3:
load * resident tab1 where Dat<$(vmaxdate);
drop Table tab1;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if this worked for you, please close the thread by accepting it as solution
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Use NoConcatenate and drop the first table.
tab1:
load * Inline
[Dat, Countr, Produc, Amoun
2022-01-20, Canada, Washer, 6
2018-07-08, Germany, Anchor bolt, 10
2018-07-14, Germany, Anchor bolt, 3
2018-08-31, France, Nut, 2
2018-09-02, Czech Republic, Bolt, 1
2019-02-11, Czech Republic, Bolt, 3
2019-07-31, Czech Republic, Washer, 6
2020-03-13, France, Anchor bolt, 1
2020-07-12, Canada, Anchor bolt, 8
2020-09-16, France, Washer, 1];
tab2:
load max(Dat) as maxdate resident tab1;
let vmaxdate=Peek('maxdate');
trace $(vmaxdate);
NoConcatenate
tab3:
load * resident tab1 where Dat<$(vmaxdate);
drop Table tab1;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are missing the single quotes,
And max maybe returning a numerical value of the date , so reformat it to date
tab2:
load Date(max(Dat)) as maxdate resident tab1;
let vmaxdate=Peek('maxdate');
NoConcatenate
tab3:
load * resident tab1 where Dat<'$(vmaxdate)';
drop Table tab1;
If a post helps to resolve your issue, please accept it as a Solution.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if this worked for you, please close the thread by accepting it as solution
If a post helps to resolve your issue, please accept it as a Solution.
