Adding a date to a filename through syntax spss modeler

382 Views Asked by At

I try to automatize my spss modeler flow and this flow exports excel files. In my excel files,the syntax is like "list_23.06.2023.xlsx". This syntax depends on which day is today,so how can i export my filename automatically?

1

There are 1 best solutions below

0
Aybuke Meydan On

I got help from a friend and I'm writing in case anyone is looking for the answer to this question.

Execution really helps in this cases. But first,you should name your nodes. "blabla" is one of the names of tools. It may be useful to print the current date information on the table and get the day from there.

import modeler.api
stream = modeler.script.stream()

table = stream.findByType("table","day")
arr = []
table.run(arr)
date = arr[0].getValueAt(0,0)

csv_file = stream.findByType("excelexport","blabla")
csv_file.setPropertyValue("full_filename","list_"+str(date)+".xlsx")