Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
For the peek function to work, does my data have to be already sort, or can I build some sorting code into my load statement. I am having some difficulty with the following code, which is producing various Peek values for the same customer, where it should only be producing one value:
[BALES LOOP]:
LOAD //[Fieldworker Name],
[Submission Id],
//[Fieldworker Id],
//[Repeats On Question],
//[Repeat Question Value],
//[Repeating Index],
Date(Floor([Received Date]),'DD.MM.YYYY') as [Received Date],
'V'& TIMB as TIMB,
Bales as [Bales Loaded]
FROM
(ooxml, embedded labels, table is [2 Bale Loop]);
[BALE LOOP]:
NoConcatenate LOAD
//[Fieldworker Name],
[Submission Id],
//[Fieldworker Id],
//[Repeats On Question],
//[Repeat Question Value],
//[Repeating Index],
[Received Date],
TIMB,
if(previous(TIMB)=TIMB,peek([Received Date]),[Received Date])as [Last Pickup],
[Bales Loaded]
Resident [BALES LOOP]
Order by TIMB,[Received Date];
DROP Table [BALES LOOP];
Can anyone assist.
Thanks
Herbert
try
Peek('[Received Date]')
or try
if(previous(TIMB)=TIMB,Previous([Received Date]),[Received Date])as [Last Pickup],
UPDATE : Please check enclosed file..
[BALES LOOP]:
...
....
[BALE LOOP]:
NoConcatenate
load
[Submission Id],
[Received Date],
TIMB,
if(peek(TIMB)<>TIMB, [Received Date], Peek([Received Date])) as [Last Pickup],
[Bales Loaded]
Resident [BALES LOOP]
order by TIMB, [Received Date] desc;
DROP Table [BALES LOOP];
There could be other problems with your code, but the peek function needs to include the field name without brackets but within single quotes:
peek('Received Date')