Internet toolkit get file date without year using ftp!!!
Hi!
I'm using "FTP Directory Listing.vi" to get the modification date of files on a ftp server (PXI-RT): I only get the time, day and month of the last modification but I do not get the year (For example: Aug 3 04:52)!?!
Have anybody an idea how to get the complete date information (For example: 2005 Aug 3 04:52)?
Thanks in advance for your help!
I agree with Corey that you may have issues with the host computer blocking your VI, but the error 15425 seems to fix itself if you change the ftp mode from active to passive. The default is true, but wiring-in a false constant should take care of the error and enable successful file transferring.
The reasons for this are explained here.
National Instruments
RIO Embedded Hardware PSE
CompactRIO Developers Guide
Similar Messages
-
Problem with getting current date and time using oracle.jbo.domain.Date
I`d like to get current date and time using oracle.jbo.domain.Date method getCurrentDate(), but it always return current date and 12:00:00. I also need to get the current time.
I think you should use java.sql.Timestamp domain.
(And set database type to TIME or DATETIME.)
Jan -
Getting current date without using client's clock
Is there a way to get the current date without using client's clock?
The java application we developed has many windows on which the Current Date is an important display field. As it's used 24x7, we need to make sure the date is current.
Right now, we make a CORBA service call to get the date from the server everytime the user Resets any of these windows. This is causing a peformance issue due to the slow service call.
Is it possible to get the Date once from the server and then start a timer to derive the date thereafter. Will a change in the client's clock affect this logic ? Can we implement this without using client's system time.
Or is there another better way ?
Thanks for your help.If I can summarize your current requirements:
1. You need to know the time.
2. You don't trust the client's clock so you want to get the time from another computer.
3. You want this access to be "not too slow".
I find requirement number 2 to be peculiar, I've never seen an application that doesn't accept the time on the client system as valid. However, there it is. Maybe it's a system for checking employees in and out, and the smarter ones have been faking out the system by changing the clock. If your CORBA connection is too slow, and NTP is too slow (it takes the little program I got from USNO about 3 seconds to synchronize my clock), why not write your own time server? A simple web server that returns only the time to any request would work. If that's not fast enough then I'd suggest you're out of luck. -
Flat files data comma separated using SSIS.
Hi,
I have multiple flat files which come in comma separated columns. See example below :
Customer Data
CustID,FName,LName,Disease,Email,Phone
12345,Xyz,Smit,Bronchitis, Asthma and fever,[email protected],80000000
12346,Abc,Doe,fever Headache,[email protected],90000000
12347,Klu,joe,Sugar, cough and fever,[email protected],12345678
Please look at the ID's 12345 and 12347. The disease column has a internal comma space between. How do i remove the comma spaces in the disease column, so that it can be loaded from flat file to sql table using SSIS. ?
Please help !
ThanksHere is a full solution base on my post above (first option)
1. create temp table (Give it a unique name):
create table #T (Txt NVARCHAR(MAX))
GO
2. Insert all the data into temporary table. Each line in the text file, is a value for one column in a row in the table.
-- I will jump to the table and use simple insert.
-- If you have problem with step 1 then please inform us (this is simple bulk insert basically)
insert #T (Txt) values
('1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000'),
('12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000'),
('123447,Klu,joe,Sugar, cough and fever,[email protected],12345678')
GO
the result should be like this:
Txt
1234435,Xyz,Stemit,Brfsdonchitis, Asthma and fever,[email protected],80000000
12346,Agjdfjbc,Doge,fevhhhher Headsxdshhache,[email protected],90000000
123447,Klu,joe,Sugar, cough and fever,[email protected],12345678
I use a SPLIT Function named Split_CLR_Fn. This is a CLR Split function that get input <string to split> and <string as delimiter,> and it return table with 2 columns ID, SplitData
For example if you use: SELECT * from Split_CLR_Fn('text1,text2,text3,',') then you get result:
ID SplitData
1 Text1
2 Text2
3 Text3
** You can find in the internet several good functions, I HIGHLY RECOMMENDED NOT TO USE T-SQL FUNCTIONS but CLR FUNCTION. Check thi link to understand why:
http://sqlperformance.com/2012/07/t-sql-queries/split-strings
** This is the best function that I know about and I use it, but I change the code a bit to return 2 columns and not just the SplitData as in this blog: http://sqlblog.com/blogs/adam_machanic/archive/2009/04/28/sqlclr-string-splitting-part-2-even-faster-even-more-scalable.aspx
That's it :-) we are ready for the solution which is very simple
Solution 1 (BAD solution but easy to write):
select
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 1) CustID,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 2) FName,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = 3) LName,
STUFF((select ',' + SplitData from Split_CLR_Fn(Txt,',') where ID > 3 and ID < (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1 for XML path('')), 1 , 1,'') Disease,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,',')) - 1) Email,
(select SplitData from Split_CLR_Fn(Txt,',') where ID = (select MAX(ID) from Split_CLR_Fn(Txt,','))) Phone
from #T
GO
Solution 2: better in this case since the format is constant (this is the solution I wrote about above)
;With MyCTE as (
select
Txt,
SUBSTRING(Txt, 1, CHARINDEX(',', Txt, 1) - 1) as CustID
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, 1) + 1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)- CHARINDEX(',', Txt, 1) - 1
) as FName
, SUBSTRING(
Txt
,CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1 -- I start from the end of preview len
, CHARINDEX(',', Txt, CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1)+1) - CHARINDEX(',', Txt, CHARINDEX(',', Txt, 1)+1) - 1
) as LName
, RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1) as Phone
, RIGHT(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1), CHARINDEX(',', REVERSE(LEFT(Txt, Len(Txt) - Len(RIGHT(Txt, CHARINDEX(',', REVERSE(Txt), 1) - 1)) - 1)), 1) - 1) as Email
from #T
select CustID,FName,LName, Phone, Email, SUBSTRING(Txt, Len(CustID) + Len(FName) + Len(LName) + 4, Len(Txt) - Len(Email) - LEN(Phone) - Len(CustID) - Len(FName) - Len(LName) - 5) as Disease
from MyCTE
I hope that this is useful :-)
Ronen Ariely
[Personal Site] [Blog] [Facebook] -
How to get max date in variable using dynamic query
Hi,
the following code gets all dates from sourcetable i want only max date , so i thought max function can be added and it will work
but still i have to create a table for one value(scalar) can get it in any other effeciant way.
declare
TYPE date_string IS TABLE OF VARCHAR(1000);
date_obj date_string;
BEGIN
EXECUTE IMMEDIATE 'SELECT to_char('''||day1||'-'||month1||'-'||year1||''') FROM '||source_schema||'.'|| sourcetable ||'' bulk collect INTO date_obj;
FOR indx IN date_obj.FIRST..date_obj.LAST loop
dbms_output.put_line(
date_obj(indx));
END loop;
DBMS_OUTPUT.PUT_LINE('Sample output');
END;
yours sincerely944768 wrote:
the following code gets all dates from sourcetableNo it doesn't. What is the datatype of day1, month1 and year1? They cannot be DATE datatypes otherwise your TO_CHAR would fail with all that concatenation going on. And your TO_CHAR is returning a VARCHAR2 datatype... so you cannot say that it is getting all dates... because there are no DATE datatypes returned. It's getting a lot of strings, but certainly not DATE's.
i want only max date , so i thought max function can be added and it will work You can use the MAX function on a DATE datatype, but not on strings (at least not in the way you intend it to work).
Converting it to a DATE before doing the MAX will allow you to get the maximum date (assuming the date format is correct)
EXECUTE IMMEDIATE 'SELECT max(to_date(to_char('''||day1||'-'||month1||'-'||year1||'''),''DD-MM-YYYY'')) FROM '||source_schema||'.'|| sourcetable ||'' bulk collect INTO date_obj;Then you will find have the other issues...
a) you are then going to be fetching your DATEs in to a collection of VARCHAR strings. (Not even VARCHAR2, very poor). This should be DATE datatype
b) you are bulk collecting into a collection, when you are using MAX which will return a single value in your example
And you really should address the design issues:
c) why are day, month and year, not being stored in the database as a single DATE datatype in the first place
d) why does your code not know the name of the table it's querying requiring the use of very poor dynamic SQL techniques.
e) why are you loading data in a collection in expensive PGA memory... what can't you do in SQL that requires you to collect the data into memory first? -
How can I get file from multiple instance using file adapter
Hi.
Our system(PI7.1) have three application instances running with each physical servers.
We use sender file adapter.
The file data is sent to one of the servers.
Now, how can I get the file using three file adater?
Should I put the file "sapmnt(\usr\sap)" .
Or are there another solution?
regards,Hi Ashutosh
You will have to use sapcar.zip which contains the utility Sapcar.exe utility for unzipping the files from SAP compressed files. (*.car file)
Regards
Gaurav
PS: Reward points if solved -
How can I get a date without the hour from sql server 2000 ?
hellou!
I have a JTable, and one of it's columns has to show a date. This date i have to show is specified as datetime on the Sql Server 2000 database where I have to take the data.
the query of the dataset attached to the JTable is something like "select * from Table".
The problem is that the JTable column that displays the date shows the date and the hour, for example:
7/10/04 0:00:00
and I need to show the date without the hour, only the 7/10/04. Can anyone tell me how to do that?
thank you very much! : )The easiest way to format a date is with java.text.SimpleDateFormat. When creating it you pass a format string which can be used to parse or format date objects.
SimpleDateFormat formater = new SimpleDateFormat( "MM/dd/yyyy" );
// Get date objects directly from sql
Date foundDate = result.getDate( 1 ); //where result is the ResultSet and 1 is the date column
String formatedDate = formater.format( foundDate );Now the JTable's table model can be adjusted to store a formated String instead of a Date. If for some reason it is required to store the value as a Date overload the table model to return the formated string when getValueAt is called. -
Flat file data loading error using process chain
Hi SAP Experts,
I am having a problem loading the flat file data to the cube using process chain. The issue is that when i run the process chain it fails giving the message " Date format error, please enter the date in the format _.yyyy" . I am using " 0calmonth in the datasource" . Strange is that when i manually execute the infopackage, i dont get any errors and am able to load the same file successfully to the dso and the cube. Is there any special setting for the process chain that i am missing?
The date format in the flat file is mm/yyyy. I have tried all the options i could including recreating the datasource and invain dont see any success so far. please help me solving this problem as we r in the middle of testing cycle.
Thanking you all for your quick response and support all the time.
Kind Regards,
SanjeevHi Sanjeev,
I believe you are opening the .csv file again after saving it. In this case the initial 0 in single digit month (say 02/2010) is getting changed to 2/2010 and the resulting file is not readable to the system. Just do not open the file after you have entered data in the .csv file and saved and closed it. If required, open the file in notepad, but not in excel in case you want to re-check the data.
Hope this helps.
regards,
biplab -
HT1766 Is there way of accessing your back up data without the use of an i-phone?
Is there a way of accessing your back up data from the computor without the use of an i-phone?
If it wasnt activated prior icloud wont help now. Did you ever use the save and print option to "send it itunes"? I did that all the time prior to icloud to back up my docs. Then you can "copy from itunes" in the new document dialog.
I still recommend doing the export to iTunes to create a local back up copy on ocassion.
For future reference, To activate icloud for documents, go into the main settings app, tap icloud, then documents and data, and turn it on. Then go to the app (maybe numbers) further down the main settings list, tap it and turn on "use icloud".
Jason -
File to IDOC scenario using FTP server
Dear Experts,
I'm getting IDOCs in the form of .TXT file from sender side and at reciever end we have IDOC. We are using FTP connection at sender.
I want to know:
1. Is FCC the only solution to integrate with PI or do we have any other option also?
2. What all the things I need to care in designing and configuration?
Thanks a lot.Dear All,
For file to idoc scenario is there any possibility to get line items details or xml details i.e the segments and its related field details using reference id, transaction id or interface name or message id in SAP PI 7.0. I know we need to click each and every message in sxi_monitor and look for details.
For SAP(R3 System) I can create a report and set the job for specific time period so automatically it throws the details(like reference no, document date, invoice no from) in ftp path as .csv file. The same ftp path is maintained in program.
I wanted to check FTP--->PI postings and I have set the job at r3 system it is working fine and Im monitoring it too.
Now the end to end scenario is FTP--->PI--->ECC(R3 system). Please help.Many Thanks. -
Files with .a extension using ftp transport
Hi.
Am using ftp adapter in osb to read .txt files(e.g. abcd.txt) from ftp location, process the body/text() in OSB and then place the incoming file to an outbound folder.
the flow is like ftp-> Proxy Service->Business Service->outbound ftp
the service works fine where then is less load or the no. of incoming files is less.
However,sometimes the outbound folder contains the files with .a extension at the end.(e.g. abcd.txt.a)
Can someone tell me the rootcause of these .a file creation and the scenarios in which the .a files are created.
Also,please tell me what are these .a files meant for?
How,can I eliminate this while configuring the services using ftp transport.
Thanks in adavanceI had this recently with a variety of FTP servers, FileZilla, Microsoft etc.
For me, it happened when the file already exists in the destination and I was expecting the destination file to be overwritten. My application would generate the same filename, say FileA.txt and expect that to be overwritten, but with OSB 10gR3 I would get files with .a stuck on the end.
This functionality changed between ALSB and OSB and I had a patch developed to restore the ALSB functionality.
I spent ages looking at it, and debugging FTP commands and going from memory, I'm pretty certain that the FTP adapter doesn't implement the correct FTP spec for the RNFR command according to the RFC in the case where a file already exists - it doesn't handle overwrite.
Hope that may help.
Pete -
SSIS 2008 - Sending file with dynamic name using FTP task
Hi - Thanks for taking a look - (I'm very new to SSIS.)
I'm trying to create an SSIS 2008 package that does the following:
1) Execute a stored procedure on SQL.
2) Download the results as a CSV file to a 'local' location. The file name is set using a variable ("User::LocalFilePath") dynamically based on the current time:
@[User::LocalFilePath] + "GreatReportName_" + "_" +(DT_STR,4,1252) DatePart("yyyy",getdate()) + Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) + "_" + Right("0"
+ (DT_STR,4,1252) DatePart("d",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) + "_" + Right("0" + (DT_STR,4,1252) DatePart("mi",getdate()),2)
+ "_" + Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2) + ".csv"
3) Transfer the CSV file to an FTP site.
4) Delete the CSV file from the 'local' location.
I've been able to do steps 1 and 2 so far. However when trying the move the newly created file to the FTP site I get the error:
"Error: 0xC002917C at Send to FTP, FTP Task: The variable "User::LocalFilePath" doesn't contain file path(s)."
(When I set the "IsLocalPathVariable" to "False" and use a file previously created the file is correctly transferred to the FTP site. This proves that the FTP details are correct and that the "RemotePathVariabe" is working
correctly.)
I have set the variable ("User::LocalFilePath") to "EvaluateAsExpression" in the variable properties.
Can anyone help?
Many Thanks,
UnoTHi Vaibhav,
Thanks for your response. I set the "DelayValidation" to "True". However
that didn't make any difference.
I added in all the breakpoints, but it didn't give any results (I may be doing this incorrectly?):
Any other suggestions?
Thanks,
UnoT -
Help Downloading a file from a server using FTP with only URL methods
Hi All
I have written this code and it is not working I dod not know why the download is not working please help is there anything that's missing?
* Download the file
public void download(String fileName, String destination)
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
// File destDir = null;
try
String urlString = "ftp://"+userName+":"+password+"@"+hostName+"/"+fileName;
URL url = new URL(urlString);
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
conn.connect();
//set the destination directory
File destDir = new File("U:\\2004\\"+fileName.trim());
System.out.print("\n\n");
System.out.print("Destination set to :" +destDir);
System.out.print("\n\n");
bis = new BufferedInputStream( conn.getInputStream() );
bos = new BufferedOutputStream( new FileOutputStream(destDir.getName()));
System.out.print("get file name :" +destDir.getName());
System.out.print("\n\n");
int i;
while ((i = bis.read()) != -1)
bos.write( i );
System.out.println("Trying to download...");
bis.close();
bos.close();
catch (IOException ie)
System.out.println( "Input not available" );
This is what I get after runing this code.
get umlcourse.txt U:\2004
Destination set to :U:\2004\umlcourse.txt
get file name :umlcourse.txtTrying to download...AceV wrote:
String urlString = "ftp://"+userName+":"+password+"@"+hostName+"/"+fileName;
You probably need to specify the transfer mode. For example:
String url = "ftp://sam:spade@ftphost/myfile.txt;type=a";
// Specify type=i for binary. -
Writing timestamp on the content of file (not the filename) using FTP Adapt
Hi Experts,
Is it possible to write a timestamp (from the source server) to a target logfile if I'll use FTP Adapter?
Here the scenario:
Source:
source.log -> the contents is AAAA (the timestamp base from the server is [06/09/10 10:00])
- basically the source.log file is overwritten with the same content but the timestamp is changed so that's would be scenario
it will checked by the FTP adapter....
Target:
target.log -> the content of the file is 06/09/10 10:00
so probably if i have a target logfile I'll just have to append the file as this
06/09/10 10:00
06/09/10 10:02
06/09/10 10:04
06/09/10 10:06
06/09/10 10:08
06/09/10 10:10
If it's possible, how will I do this? Do I need script? or just normal settings of the FTP adapter?
R-jayYes, is posibble. if i not wrong, you can do this ussing Dynamic configuration.
see those links
/people/ryan.crosby/blog/2009/02/27/file-xi-proxy-scenario--moving-binary-files-with-accompanying-filename-attribute-in-converted-xstring-format
http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
Thanks
RP -
How to fetch and save file in common server using FTP in SAP
Dear All,
My requirement is to fetch a image and save an image in a common server through SAP .
I think there is some concept of doing the same using FTP.
Please put some light on this issue.
REgards,
AmrutaHi,
Below are the FM's use to FTP.
FTP_CONNECT Connect to FTP server
FTP_COMMAND Execute FTP Command
FTP_DISCONNECT Disconnect from FTP server
You can search SDN for more details on each of the FM's.
Hope this helps
Regards
Shiva
Maybe you are looking for
-
With iOS 5, can I use my iPad or MacBook Pro to watch Hulu on Apple TV?
I want to be able to watch Netflix and Hulu on my TV, and while Ragu is the only device I can find with that capability (besides the XBox 360 for over twice the cost), I want to know if there is a workaround on the Apple TV using AirPlay. I love the
-
Page error causes server to crash
These are the symptoms: we start loading a page and Oracle launches a process that hogs as much CPU as it can, slowing everything on the server to a near standstill. If we don't catch it within about 5 minutes, we cannot even log on to kill the proce
-
A30: Need Pixel Shader for playing Black & White 2
Hello I've just installed Black and white 2 on my laptop an when i open up the game it says 'Black and white 2 only supports graphics cards with Pixel Shader 1.1 or above. Can i download this or do i have to upgrade my Graphics Card and what kind of
-
No space between phonetic name and department
Has anyone experienced a problem on iPhone running iOS7 when using contacts. I recently added information to one of my contacts: department, phonetic name, company, etc. When I was done, I pushed "Done" and it showed me info without space between pho
-
Excel for mac (14.1.3), opens but the pages are blank?
I'm trying to read excel documents sent to me on mail in an els or xlsx format but all open with no text. I have read that excel should work fine on OSX Lion but cant find anything on this current problem. Any ideas?