Variable filename and folder in receiver cc
Dear experts,
On PI, I need to create a (text-) file with a variable name and folder. The scenario is as follows:
idoc-> PI -> txt file
In my incoming Idoc I get the following data:
- directory where the txt file should be saved;
- name that the txt file should get.
How can I realise this in PI? Using variable substitution? As I never done this before, I have a hard time getting this to work...
Please help.
Thanks in advance
William
Hi,
Use Dynamic Configuration:
Input will be 2 variables var1, var2.
String Name1 = var1;
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
conf.put(key1, Name1);
String Name2 = var2;
DynamicConfigurationKey key2 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
conf.put(key2, Name2);
return "";
Maping:
Var1---
UDF----TargetMessageNode.
Var2---
Under ID: Enable ASMA in file receiver adapter and chk FileName and Directory.
and put * under File name and / underTarget Directory(File receiver).
NOTE: U can alter this UDF according to ur req.
Thanks
Amit
Similar Messages
-
The variable $filename and the the *.fm extension
When you need the title of the document importing into a document, you can use the variable <$filename>.
This is useful as you can have a template that changes its name with the name of the file.
However, the variable always writes the document name with the file extension (for example help.fm) making the variable useless.Gareth,
Please also enter a feature request using the official request route via Bugbase & Wishlist and provide some use cases. -
I've been using a script to use automator to create a folder from the filename and put that file into it the folder just created.
I have a bunch of files that have similar names to them, but I don't want every file to be put into its own folder, instead I want all files with the same suffix (001) to go into the same folder. I would also like the folder name to just be named the same as the suffix (001) instead of the full file name.
For example all of these files names that end with the same integer (001) should be dumped into the same folder named "001":
Boston_ProRes422_1920x1080_24p_Audio_001
Boston_ProRes422_3840x2160_24p_Audio_001
Boston_ProRes422_3840x2160_24p_RAW_Audio_001
Boston_ProRes422_1920x1080_24p_Audio_002
Boston_ProRes422_1920x1080_24p_Audio_005
Boston_ProRes422_1920x1080_24p_Audio_010
Any help at all would be incredible!!
Thanks!
Here's the script I'm using right now:
on run {input, parameters} -- create folders from file names and move
set output to {} -- this will be a list of the moved files
repeat with anItem in the input -- step through each item in the input
set {theContainer, theName, theExtension} to (getTheNames from anItem)
try
set destination to (makeNewFolder for theName at theContainer)
tell application "Finder"
move anItem to destination
set the end of the output to the result as alias -- success
end tell
on error errorMessage -- duplicate name, permissions, etc
log errorMessage
# handle errors if desired - just skip for now
end try
end repeat
return the output -- pass on the results to following actions
end run
to getTheNames from someItem -- get a container, name, and extension from a file item
tell application "System Events" to tell disk item (someItem as text)
set theContainer to the path of the container
set {theName, theExtension} to {name, name extension}
end tell
if theExtension is not "" then
set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
set theExtension to "." & theExtension
end if
return {theContainer, theName, theExtension}
end getTheNames
to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
set theParent to theParent as text
if theParent begins with "/" then set theParent to theParent as POSIX file as text
try
return (theParent & theChild) as alias
on error errorMessage -- no folder
log errorMessage
tell application "Finder" to make new folder at theParent with properties {name:theChild}
return the result as alias
end try
end makeNewFolderThanks Neil for the response! That script didn't work, but I did get it to work with my old script by changing "set TheName to" numbers different. Here's my final script which creates folders named "001", "002", and so forth and dumps in the files that end in that same suffix in the matching folder.
on run {input, parameters} -- create folders from file names and move
set output to {} -- this will be a list of the moved files
repeat with anItem in the input -- step through each item in the input
set {theContainer, theName, theExtension} to (getTheNames from anItem)
try
set destination to (makeNewFolder for theName at theContainer)
tell application "Finder"
move anItem to destination
set the end of the output to the result as alias -- success
end tell
on error errorMessage -- duplicate name, permissions, etc
log errorMessage
# handle errors if desired - just skip for now
end try
end repeat
return the output -- pass on the results to following actions
end run
to getTheNames from someItem -- get a container, name, and extension from a file item
tell application "System Events" to tell disk item (someItem as text)
set theContainer to the path of the container
set {theName, theExtension} to {name, name extension}
end tell
if theExtension is not "" then
set theName to text -5 thru -((count theExtension) + 4) of theName -- just the name part
set theExtension to "." & theExtension
end if
return {theContainer, theName, theExtension}
end getTheNames
to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
set theParent to theParent as text
if theParent begins with "/" then set theParent to theParent as POSIX file as text
try
return (theParent & theChild) as alias
on error errorMessage -- no folder
log errorMessage
tell application "Finder" to make new folder at theParent with properties {name:theChild}
return the result as alias
end try
end makeNewFolder -
Itunes was working earlier and now I receive message that says "the folder "itunes" is on a locked disk or you not have write permissions for this folder" - what is this and how can I fix the problem?
Hey HaydenJulie,
Thanks for the question, and welcome to Apple Support Communities.
The following article provides information on permissions issues with iTunes. The troubleshooting steps included may resolve your issue:
iTunes: Missing folder or incorrect permissions may prevent authorization
http://support.apple.com/kb/TS1277
Thanks,
Matt M. -
Webi - store report in Variable filename.
Hi,
I have BO Webi report say XYZ which is schedule and run on weekdays. once it is refresed I wanted to give name as XYZ_YYYYMMDD.XLs ( where YYYYMMDD is system date).
in CMC there is option to name the report with some extension ( CMS-> Folder->Schedule->Destination and specify filename radio button). but the one I am looking is not available.
is there any way to change the report name with some variable value and store in Excel ?
Your early response would be appreciated.
Regards,
AviYou can select 'Date and Time' when check specify file name. Select 'Title' put an hyphen and select 'Date and Time' and also check 'add file extension'.
-
Insert filename and path?
Hi,
Can you insert the filename and path into a footer in a ID document same as you would with a Microsoft Word document?
Thank you,
BarbWith CS3 use a text variable.
Bob -
I have 3 mail accounts in apple mail. One of them has had the spinning ball going for several days and I cannot receive mail in this account or delete messages etc. For some reason, I CAN send mail on Apple mail using this account, although it takes several minutes. I can receive mail in this account on my iPad and by signing into aol on safari and internet explorer on my office PC. It's obviously a glitch in Apple's Mail. I've deleted this account and reopened it in Mail on my Mac Pro with no difference. Any suggestions would be greatly appreciated, this E amil account is major to my business.
http://support.apple.com/kb/TS3276
sounds like a corrupt database or index
the glitch is your home folder and mail folder, esp look at syncservices
I'd post in the mail or Lion forum where you will find similar issues being discussed.
http://www.apple.com/support/mail -
Read character 3+4 from filename and move to other position
Hello,
I need a javascript to read my filename (I have the one for the full filename) and especially the 3rd and 4th position of the filename.
The characters on position 3 and 4 must be moved to the position just before the extension.
Example:
4PEN12345.pdf (old name) should be 4P12345_EN.pdf
Now I have the following script to extract all pages in an existing pdf file to separate pages with all the same suffix before the extension
/* Extract Pages to Folder */
var re = /.*\/|\.pdf$/ig;
var filename = this.path.replace(re,"");
for ( var i = 0; i < this.numPages; i++ )
this.extractPages
nStart: i,
nEnd: i,
cPath : filename + "_page_" + (i+1) + "_EN.pdf"
Can anybody help me to set me on the right direction?Now I have the file 4PBG12345-1.pdf (7 pages included in the pdf).
Your script as I filled in:
/* Extract Pages to Folder */
var re = /.*\/|\.pdf$/ig;
var filePath = this.path.replace(this.documentFileName, "");
var oldFileName = this.documentFileName;
var suffix = oldFileName.substring(2,4);
var newFileName = oldFileName.substring(0,2) + oldFileName.substring(4).replace(".pdf", "_"+suffix+".pdf");
var newFilePath = filePath + newFileName;
for ( var i = 0; i < this.numPages; i++ )
this.extractPages
nStart: i,
nEnd: i,
cPath : newFilePath
Result:
1 file ==> 4P12345-1_BG.pdf (7 pages included in the pdf)
Of course, because the syntax for extracting and adding automatic pages is not filled in. So, that was my question, how must I nest to add the right:
Filepath+oldfilenamesubstring(0,2)+oldfilenamesubstring(4)+_page_i++_+suffix+.pdf in the extract section
So, my example must result in 7 pdf's:
4P12345-1_page_1_BG.pdf (with content of page 1)
4P12345-1_page_2_BG.pdf (with content of page 2)
4P12345-1_page_3_BG.pdf (with content of page 3)
4P12345-1_page_4_BG.pdf (with content of page 4)
4P12345-1_page_5_BG.pdf (with content of page 5)
4P12345-1_page_6_BG.pdf (with content of page 6)
4P12345-1_page_7_BG.pdf (with content of page 7) -
Split filename and create folders with Powershell script ( --newbie user)
I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
C:\workpics\1238955678.1
C:\workpics\744556224.1
C:\workpics\744556224.2
C:\workpics\8445655996.1
I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
C:\workpics\12389\55678.1
C:\workpics\7445\56224.1
C:\workpics\7445\56224.2
C:\workpics\84456\55996.1
Any assistance to create this Powershell script would be awesome. Thank you!!I have a folder with 1000's of files. Each file varies in length; typically between 9-14 characters. Example:
C:\workpics\1238955678.1
C:\workpics\744556224.1
C:\workpics\744556224.2
C:\workpics\8445655996.1
I would like to run a script to split the filename and separate into folders. The filename would then consist of 5 characters, the foldername would be the first characters remaining.
C:\workpics\12389\55678.1
C:\workpics\7445\56224.1
C:\workpics\7445\56224.2
C:\workpics\84456\55996.1
Any assistance to create this Powershell script would be awesome. Thank you!!
Please reread your request. It makes no sense. Read each statement carefully and notice that the statements are in conflict.
Start your scrip in PowerShell. Look up things like how to list files and how to manage strings. All of the information you need is here:
http://technet.microsoft.com/en-us/scriptcenter/dd793612.aspx
¯\_(ツ)_/¯ -
Java Message Mapping : Dynamic FileName and Directory for ASMA
How to Put Dynamic FileName and Directory for ASMA Properties of File Receiver adapter in Java Message Mapping ???
I know How to Do this in UDF , But In Java Type Message Mapping . How to do this ????
Regards
PS.Hi
chk this:
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=95093307
Thanks
Amit -
Oracle to File, filename and order by question
Hello
I am writing a simple interface, source is an oracle table and destination is a flat file.
I have two questions:
1) the file name should be in the form allocation_ddmmyyyy.txt, where ddmmyyyy is the current date. which is the best way to accomplish this?
2) the file should be sorted with some criteria, which could be easily achieved with an order by clause in the source datastore, but looks this is not possible. How could I do this?Hello.
My Idea follows
(1) You create ODI Variables,then you may set ODI Variables to resource Name of data-store.
detail Example (i) you create the ODI-Variable "FILENAME" to GLOBAL
detail Example (ii) you set #FILENAME to resource name of data-store.
detail Example (iii) startscen.sh SCENARIONAME VERSION CONTEXT GLOBAL.FILENAME=allocation_ddmmyyyy.txt
(in other method, invocation API, ODI Public Web Services via Oracle WebServiceProxy API/BPEL PartnerLink invoke)
(2) you customise IKM. you add "order by criteria" to the command "Insert new rows" 's SQL.
If criteria is not const, you should use ODI Variables or Java Variables.
othewise,you may use harcord literal.
Please challenge my idea.
Message was edited by:
futokiyo -
How to know the filename and extension of a file in PKCS7 envelope
Hi! I've a programm that makes a PKCS7 file. I'm enveloping just one file at a time. I want to know if there is a way to know the filename and extension of the file INSIDE de PKCS7 envelope. Because I receive a file that has .p7 extension, but the real document, the one to be decyprted, I don't know its name nor its extension, and I need both for writing it (I will not just invent some name).
Best regards!The construct of the PKCS7 structure you have, is defined in rfc2633. The part defining EncapsulatedContent is introduced in CMS [rfc2639], where no such attribute for a file name is saved in the structure.
In some occasions, when it is critical, organizations add own object identifier and attibutes to save such descrptivie information as filename and extension.
A practical approach is, on the signing side, sign the file A.ext to A-ext.p7m resp. A-ext.p7s
You can not assume a global approach to get back the original filename (if you have no agreement on not the signing peer as above) of the encapsulated data. The reason is, the encapsulated data field is general and it does not neccesarily mean it was a file (a part of a stream or any definite sequence of bytes in general). -
Getting Output filename and extension same as the incoming filename and extension
I need to create a SFTP send port where I should get the output file name and extension same as that of the incoming filename
I had set the filename in the send port as "%SourceFileName%" but this did not work.
I have also assigned the input filename (without extension) in a variable in orchestartion. Is there any way i could get the output filename and extension same as that of the incoming message?
Any help would be much appreciatedHi,
The %SourceFileName% macro maps to the context property BTS.ReceiveFileName that travels with your message in the context. So in order for this macro to work in a send port the message that is going out needs to have this BTS.ReceiveFileName property on
the context. You probably creating a new message in your orchestration and sending that out. The new message does not have the property on its context which makes it fail. Use a message assignment shape in your orchestration to set the context property for
the message going out:
MyMessage(BTS.ReceiveFileName) = OrigMessage(BTS.ReceiveFileName);
Then %SourceFileName% macro will work at send port.
Rachit
Please mark as answer or vote as helpful if my reply does -
How to send mails to "CC" and "BCC" using receiver mail adapter dynamically
Hi,
Due to business requirement PI need to send mails dynamically to u201CCCu201D and u201CBCCu201D using receiver mail adapter.
We have an option to send mails to u201CTou201D dynamically, but are there any option to send mails u201CCCu201D and u201CBCCu201D dynamically.
Please some help to resolve the issue. Thanks
Regards,
Sreeramulu Konjeti.Hi Sreeramulu,
As mentioned by Lucas, you can use the UDF. Inn addition to that, you need to define the Variable Headers under Variable transport binding after enabling the Adapter Specific Message Attributes.
For the Enabling ASMA, follow the below steps and check for the variable attributes.
Select the Advanced tab page.
To save adapter-specific attributes in the message header of the XI message, select Use Adapter-Specific Message Attributes and Variable Transport Binding.
The following attributes in the message header are then available for processing:
○ User: (technical name: TServerLocation)
○ Authentication key: (technical name: TAuthKey)
The following mail header fields are available for processing:
○ From: (technical name: THeaderFROM)
○ To: (technical name: THeaderTO)
○ Cc: (technical name: THeaderCC)
○ Bcc: (technical name: THeaderBCC)
○ Subject: (technical name: THeaderSUBJECT)
○ Reference to the mail that is to be replied to: (technical name: THeaderIN-REPLY-TO)
○ Reply to: (technical name: THeaderREPLY-TO)
○ Mail client program: (technical name: THeaderX-MAILER)
○ Send confirmation of receipt: (technical name: THeaderDISPOSITION-NOTIFICATION-TO)
○ Priority: (technical name: THeaderPRIORITY)
○ Importance of message: (technical name: THeaderIMPORTANCE)
To transfer further header fields, set the relevant indicator for Variable Header. The technical names for the fields are XHeaderName1, XHeaderName2, and XHeaderName3.
The parameters are included in the mail header under the names specified here.
The attribute namespace for the adapter is http://sap.com/xi/XI/System/Mail.
Thanks, -
Can´t use ÅÄÖ in filenaming and in urxvt [SOLVED]
I´m getting nutts, I searched the net on how to get it to work but haven´t found a solution.
In Nautilus I can´t change a file or folder to a name with ÅÄÖ in the name, when i try it just prints me that it´s not valid.
And in urxvt I can´t type ÅÄÖ either, nothing happens when I press the keys.
It works fine when writing in documents and so on but not in filenames and urxvt.
Here is some of my configed files...
rc.conf
LOCALE="sv_SE.utf8"
HARDWARECLOCK="localtime"
USEDIRECTISA="no"
TIMEZONE="Europe/Stockholm"
KEYMAP="sv-latin1"
CONSOLEFONT=
CONSOLEMAP=
USECOLOR="yes"
fstab
/dev/sda3 /mnt/sda3 ntfs-3g defaults,user,locale=sv_SE.utf8 0 0
In locale.gen both "sv_SE.UTF-8 UTF-8" and "sv_SE ISO-8859-1" is uncommented.
Would really appreciate some help here
Last edited by neuwerld (2009-04-17 18:25:11)1) Try "setxkbmap se", after xorg-server 1.6 and/or evdev 2.2.1 update I have to use setxkbmap with X, "fi" layout in /etc/hal/fdi/policy/10-keymap.fdi doesn't seem to work
2) Start urxvt from another urxvt, and if you see something like
urxvt: the locale is not supported by Xlib, working without locale support.
try starting with LC_CTYPE="en_US.utf8" urxvt and see if it works; of course you would need that locale. I personally specify LC_CTYPE in ~/.profile.
I used option 2) with success before, but now I use 1) since 2) doesn't seem to be enough.
In ttys I get "åäö" with "altgr+åäö", without altgr it's "}{|" respectively. Haven't really looked into it, since i don't use them
Also, ntfs doesn't need locale option anymore http://www.ntfs-3g.org/releases.html
Change: The 'locale=' mount option is not used anymore for filename characterset conversion. Instead filenames are always converted to UTF-8.
Maybe you are looking for
-
How to create ICon/Cursor from pdf files
I was able to create ICon from jpg file without problem but I couldn't create ICon from pdf files. Here my code: var myDoc = app.newDoc(); myDoc.importIcon("myIcon"); // it worked when I chose a jpeg image, but it didn't //when chose a pdf file.
-
How tonswap new email address for old one in apple ID. When I try to make my new gmail address my apple ID it won't accept it because it's already in use as my rescue email. I'd like my other email to be rescue email and gmail to be apple ID but th
-
Office 365 support is not up to the task
This post is going to be a rant but I will try to keep it pithy. Maybe I can set some expectations for current and prospective O365 customers. With some luck, maybe an MS employee (a real employee) will consider this information with some perspective
-
Windows Error: "There is no disk in the drive"
When I connect or update my iPod using iTunes, I get a Windows Error stating "There is no disk in the drive. Please insert a disk into drive F:." F: is the drive that my iPod appears in explorer while the device is updating. Is this a problem with th
-
Hi Experts, i am going to implement a ASA5505 in one of my offices. I would like to use web filtering feature on it. Will it cause any performance degradation in ASA? will it utilized more memory? Thanks Vipin