cancel
Showing results for 
Search instead for 
Did you mean: 

Check CSV file name while uploading file?

Former Member
0 Kudos

Hi All,

I am uploading data from CSV file.. That part is working fine.

Now i want to check CSV file name. Ex : CSV file name = W1234H4321AB.

I want to check 6th letter, if 6th letter is eq 'H', i want to upload data otherwise should display some message.

I tried by reading this attribute, but i declared this type as XSTRING, i checked value after using get_Attribute in lv_datasouce. It contains some XSTRING value. How to get CSV file name??

Cheers,

Venkys.

Accepted Solutions (0)

Answers (1)

Answers (1)

gill367
Active Contributor
0 Kudos

The file upload UI element has the property FILENAME.

bind it to some string attirbute.

and check its value in the eventhandler.

do some string operations to find out the desired character.

if true then proceed other wise throw the message.

thanks

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>I want to check 6th letter, if 6th letter is eq 'H', i want to upload data otherwise should display some message.

Everything that you have been told about using the filename property of the FileUpload is correct. However you should note that the filename will not be available until after the file has already been upload to the server. So you can't stop the fileUpload based upon a check of the filename - its too late and the upload has already occured.

gill367
Active Contributor
0 Kudos

>

> >I want to check 6th letter, if 6th letter is eq 'H', i want to upload data otherwise should display some message.

>

> Everything that you have been told about using the filename property of the FileUpload is correct. However you should note that the filename will not be available until after the file has already been upload to the server. So you can't stop the fileUpload based upon a check of the filename - its too late and the upload has already occured.

yeah that is true. but is there anyway to check it otherwise.

or we need to wait for something in coming versions 7.3 or 7.4.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

No. There is no client side check nor are there any plans to have a client side check.

Former Member
0 Kudos

Hi Sarbjeet,

I done as u said, but this filename contains complete path.. i want only filename,

By doing some string operations i can get filename, but if path changes then it fails. Any suggestions please?

Cheers,

Venkys.

Former Member
0 Kudos

Hi Thomas,

Thanks for your reply, So there is no way to validate filename while uploading? can i fix it?

Cheers,

Venkys.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Thomas,

>

> Thanks for your reply, So there is no way to validate filename while uploading? can i fix it?

>

>

>

> Cheers,

> Venkys.

No. There is no validation done until the upload is complete.

As to your filepath to filename, you should be able to parse the path dynamically with either SHIFTs or with a Regular Expression. No reason to have to hard code for the path.

Former Member
0 Kudos

Thanks Thomas and sarbjeet.

Cheers,

Venkys.