Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
djnqlear
Partner - Contributor III
Partner - Contributor III

Split field and add dates

Hi i have a field with all 365 days were days are marked either 01,03 or 04.

There are 3 fields stream(5), year(2020) and note(03030101040101010101...........)

I want to split and date note like

2020-01-01         03

2020-01-02         03

2020-01-03         01

is it possible? se sampledata.qvw

 

Labels (2)
1 Solution

Accepted Solutions
Kushal_Chawda

@djnqlear  not sure if I completely understand . But gave it a shot

Data:
LOAD Year,
     Stream
     date(makedate(Year)+IterNo()-1) as Date,
     mid(Note, IterNo()*2-1,2) as Note,
     Note as Note_Original
FROM Table
while IterNo() <= (len(Note)/2);
      

View solution in original post

7 Replies
Kushal_Chawda

@djnqlear  what is logic to get date from long Note field value?

Vegar
MVP
MVP

I'm thinking that you could do something similar to this. 

For i =0 to 264

Load

stream,

year,

dayname(yearstart(makedate(year)) + $(i)) as Date,

mid(note, $(i) *2+1) as note

From source;

Next i

djnqlear
Partner - Contributor III
Partner - Contributor III
Author

I want the dates marked with 03 or 04

Daniel

djnqlear
Partner - Contributor III
Partner - Contributor III
Author

first 2 char in note field is 2020-01-01  next 2 2020-01-02 ....

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

For example, if your data was in a Resident table "Data" (adjust to where ever your input is).

LOAD
  Stream,
  Year,
  Date(MakeDate(Year) + IterNo()) as Date,
  Mid(Note, IterNo() * 2 - 1, 2) as NoteValue
Resident Data
While IterNo() * 2 < len(Note)
;

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

djnqlear
Partner - Contributor III
Partner - Contributor III
Author

Dates missing 2019-01-01?

 

Kushal_Chawda

@djnqlear  not sure if I completely understand . But gave it a shot

Data:
LOAD Year,
     Stream
     date(makedate(Year)+IterNo()-1) as Date,
     mid(Note, IterNo()*2-1,2) as Note,
     Note as Note_Original
FROM Table
while IterNo() <= (len(Note)/2);