on 05-14-2009 1:07 PM
Hi...
I need one help in writing UDF...
Source Structure:
Root --- o to unbounded
Server Name
Product name
Corporate Name
Filetype
SerialNum
My requirement is like,
If the Server name = "A" and Product Name = "X", then
filename = concatenate{ConstantXCorporateNamecurrentDate(DDMMYYYY)currenttime(HH:mm:ss)SerialNum+filetype]
else
filename=concatenate{ConstantYCorporateNamecurrentDate(DDMMYYYY)currenttime(HH:mm:ss)SerialNum+filetype]
Can you please help in writing UDF for the above requirement.
Hi,
Take these inputs for that UDF
Server Name , Product name , Corporate Name , Filetype ,SerialNum
and select context while creating the UDF and import this import java.text.;* in UDF
String fileneme = "";
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
java.util.Date date = new java.util.Date();
for( int i=0; i<ServerName.length ; i++)
{
If (ServerName<i> .equals("A")&& ProductName.equals("X"))
{
filename = "X"+CorporateName<i>+dateFormat.format(date)+SerialNum<i>+filetype<i>;
result.addValue(filename);
}
else
{
filename = "Y"+CorporateName<i>+dateFormat.format(date)+SerialNum<i>+filetype<i>;
result.addValue(filename);
}
}
Map like this.
Server Name----\
Product name--\
Corporate Name-----UDF------filename
Filetype----------------/
SerialNum-----------/
This code is without Dynamic configuration and it just give the logic to construct the file name and You do your necessary Dynamic config Part
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If the condition is satisfied more than 1 time Do you want multiple files to be generated.
Will you please state your requirement clearly.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Is your requirement is to set the filename dynamically...? If your root has occurrence unbounded are you splitting the file....? In the UDF do you require to validate all the occurrence of server name and product name and which element occurrence would to set in the filename.... explain you requirement more clearly...
Thanks,
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.