How to create a csv file in TC55 Internal folder

Hi all,

I want to create a file in TC55 but getting permission denied error at "/internal/download/" I tried to create in SDCard also same error. but its working in emulator please help me to solve this problem.

I used this method

var myFile = new Rho.RhoFile(Rho.File.join(Rho.Application.userFolder,"myfilename.txt"),<file open mode>);

to create a file. but getting uninitialized constant Rho:RhoFile error in tc55 device. Please advise how to resolve this issue.

Below is My sample code:-

@filename = "/internal/RWSFilePath/StockTakeResult/StockTakeResult.csv"

File.open(@filename, "w+") do |aFile|

if aFile

  aFile.syswrite("HEADER,CSTK201234234,poonam.sharma,C,")
  aFile.syswrite("\n")
  aFile.syswrite("StockTakeDetail,TicketNo,AssetID,AssetCode,ZoneID,ZoneCode,LocationID,LocationCode,SubLocation1ID,SubLocation1Code,SubLocation2ID,SubLocation2Code,SubLocation3ID,SubLocation3Code,CategoryID,CategoryCode,SerialNo,Remarks,LabelStatus,VerificationStatus,TicketClose")
  aFile.syswrite("\n")  

end

end

Jon Tara
Confused by your code

Confused by your code examples. You have two. Which is the code you are actually having trouble with?

Is this Javascript of Ruby? Your examples are inconsistent:

  Rho.RhoFile

  Rho.File

  File

Which is it? It should be:

Ruby:  Rho::RhoFile

Javascript: Rho.RhoFile

File is the standard Ruby File class. You can use it as well, but it's not exactly the same. Not really sure what the advantage of RhoFile is, other than it has some Rhodes-specific things like join, file paths, etc.

Rho::File is an old 2.2 API. If you are using Rho::RhoFile, do not use Rho::File.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mohankumar SK
I am using Ruby for creating

I am using Ruby for creating a file in TC55.

require 'fileutils'

@filename = "/internal/RWSFilePath/StockTakeResult/StockTakeResult.csv"

File.open(@filename, "w+") do |aFile|

if aFile

      aFile.syswrite("HEADER,CSTK201234234,poonam.sharma,C,")

      aFile.syswrite("\n")       

aFile.syswrite("StockTakeDetail,TicketNo,AssetID,AssetCode,ZoneID,ZoneCode,LocationID,LocationCode,SubLocation1ID,SubLocation1Code,SubLocation2ID,SubLocation2Code,SubLocation3ID,SubLocation3Code,CategoryID,CategoryCode,SerialNo,Remarks,LabelStatus,VerificationStatus,TicketClose")

      aFile.syswrite("\n")

end

end


and also I tried the below code

@myObj = Rho::RhoFile.new(Rho::RhoFile.join("","internal", "RWSFilePath", "ImportStockTake", "CSTK20140900043.csv"),  Rho::RhoFile.OPEN_FOR_READ_WRITE)


but same I am getting permission denied error. I am able to read the Files from the Folder but not able to create (write). Please help.


Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mohankumar SK
Can you please any one help

Can you please any one help me. I want to create a file .csv in internal storage or SD Card of TC55 device. I am getting permission denied error. I rooted the device also still can't create a file.

Why I want to create a file in Internal Storage means, I want to manually transfer the file to PC / Laptop. After rooted I am able to write under system Folder but this folder is not able to see in PC. Is there any way to move the file from system folder to Internal Storage programmatically ?.

Please help. Thanks in Advance .

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Bhakta Ranjan S...
Hi,Set below configuration in

Hi,

Set below configuration in your build.yml file and try again.

android:

capabilities:

- sdcard

Thanks

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Mohankumar SK
Thanks Bhakta Ranjan, It's

Thanks Bhakta Ranjan, It's working using sdcard capabilities. is there any way to store internal storage of the phone. as per my requirement i want to transfer the file to PC and Laptop and upload the data's to server.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kutir Mobility
Mohan,May we know why you

Mohan,

May we know why you want to transfer to PC and then upload the data's to Server instead of directly uploading the file using the Rhodes API?

Visnupriya R

Kutir Mobility

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mark Nongkhlaw
Is transferring file to PC

Is transferring file to PC via Bluetooth possible for you?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kutir Mobility
Hi Was your problem resolved

Hi

Was your problem resolved ?

Thank you.

Visnupriya

Kutir Mobility

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Mohankumar SK
My problem has been resolved

My problem has been resolved using SD Card. but possible to save directly in Internal storage should be great.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kutir Mobility
>My problem has been resolved

>My problem has been resolved using SD Card. but possible to save directly in Internal storage should be great.

>

Hi

Can you consider adding this feature request to product backlog ?

Visnupriya R

Kutir Mobility

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kutir Mobility
Hi Mohan,Can you share why

Hi Mohan,

Can you share why you are trying to copy file to PC manually?

To my knowledge, some devices doesn't give access to store file in Internal Storage.

Have you tried it some other android devices?

Visnupriya R

Kutir Mobility

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments