COGNOiSe.com - The IBM Cognos Community

ETL, App Development and other tools => COGNOS DecisionStream/Data Manager => Topic started by: SynexusStuart on 24 Sep 2010 06:24:19 AM

Title: Variable date delivery name
Post by: SynexusStuart on 24 Sep 2010 06:24:19 AM
Hi,

I have to create a text file every day using Data Manager, this runs to a local folder on the server named "AppointmentLetters.txt".

What I would like is each day's file to be date stamped with the day it was run so we'd have:

AppointmentLetters_20100924.txt
AppointmentLetters_20100923.txt
AppointmentLetters_20100922.txt
AppointmentLetters_20100921.txt etc etc...

Currently, I would have to manually change the file names every day.

Is it possible to automate the above using DM?

Any help (even to tell me that it's impossible) would be useful.

Cheers,
Stuart


Title: Re: Variable date delivery name
Post by: MFGF on 30 Sep 2010 01:03:46 PM
Hi,

I reckon this should be fairly straightforward - just define a variable in the build which is populated with the filename you want to save to (use the Sysdate() function to get the current date and time), then use the variable as the filename in the delivery module.

Regards,

MF.
Title: Re: Variable date delivery name
Post by: SynexusStuart on 05 Oct 2010 04:50:09 AM
Thanks MF,

I created the Variable (called "DateStamp").

The problem I have is getting the variable into the filename. How do you do this?

In FactDeliveryProperties > ModuleProperties there is a place to write a file destination. This must be suffixed with ".txt" but how do i put the variable in the directory string?

Hope this makes sense!

Stuart
Title: Re: Variable date delivery name
Post by: MFGF on 05 Oct 2010 06:26:12 AM
Hi Stuart,

From the top:

1. Create your variable (DateStamp) in the properties of your build.  Define it as a CHAR datatype and with a size (precision) of 35.  Set the initial expression to be Concat('AppointmentLetters_',Left(ToChar(Sysdate()),10),'.txt')

2. Set the Output Filename of your Text File Delivery (Fact Delivery Properties, Module Properties tab) in the build to be <some path or other>\{$DateStamp}

Hopefully this should work OK for you.

Best regards,

MF.