0 votes
in HGrid247 DE by (310 points)
edited by
Apa ada fungsi untuk mendapatkan data yang masuk kedalam kriteria data 3 bulan terakhir, dengan hanya 1 parameter tanggal yang tersedia?misalnya :

f1|f2|tanggal
1|2|20220302
2|2|20200404
P|Z|20210702

sehingga, jika sekarang adalah tanggal 29 Sept 2021, maka yang akan keluar adalah data baris ketiga saja. Jika belum ada kira2 solusinya seperti apa ya?

2 Answers

0 votes
by (8.3k points)
Tambahka fungsi transformasi curretTimeTamp

Pada assembly berikutnya  di hitung diff antara tanggal dengan curent time stamp

kemudian di filter  denga krietira diff < (selisih)*30*3
by (310 points)
mantab...terima kasih pak Arifin, kami coba dulu pak  :)
+1 vote
by (8.3k points)
Alternatif solusi :
addMonth(-3) ke current_date simpan ke field last_3_month
kemudian filter dengan kriteria
tanngal> last_3_month and
tanggal<=current_date
Contoh Flow nya
DataFeeder_1 :

Data Feeder : DataFeeder_1 Feeds constant data :


1|2|20220302
2|2|20200404
P|Z|20210702
3|y|20210901


 


Transformator_1 :
Transformator Transformator_1 transforms the output of 'DataFeeder_1' using the following transfromation function(s)

 

Input Field Operation Output Field Type
line
RegexSplitter(Splitter=|)
f1
f2
tanggal
String
String
String
CurrentTimestamp
current_date Timestamp


Transformator_2 :
Transformator Transformator_2 transforms the output of 'Transformator_1' using the following transfromation function(s)

 

Input Field Operation Output Field Type
f1 No Operation f1 String
f2 No Operation f2 String
tanggal
StringToTimestamp(yyyyMMdd)
tanggal Timestamp
current_date
AddMonth(-3)
last_3_mont Timestamp
current_date No Operation current_date Timestamp


Filter_1 :
Filter Filter_1 filters the output of 'Transformator_2' using the following criteria

 

  tanggal > [last_3_mont]  AND
  tanggal <= [current_date]  


Transformator_3 :
Transformator Transformator_3 transforms the output of 'Filter_1' using the following transfromation function(s)

 

Input Field Operation Output Field Type
f1 No Operation f1 String
f2 No Operation f2 String
tanggal
TimestampToString(yyyyMMdd)
tanggal Timestamp


Std Output StdOtutput_1 writes the output of 'Transformator_3' to the standard output .
Welcome to Labs247 Community, where you can ask questions and receive answers from other members of the community.
...