-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange Formatting #4
Comments
FYI, I am using the latest commit which you indicated resolved the strange formatting, but I am still encountering a mismatch of the information, so I am asking for your insights into resolving this strange formatting issue. I only use one row in my app so your assistance would be very helpful. |
@DogandElk , Can you please provide your sample code? I will help you on this. I am currently working Swift 4 migration. Please add sample code here! |
Thank you , I very much appreciate your assistance !
Here's the code I wrote in the view controller:
import UIKit
import SwiftLoggly
import SwiftCSVExport
class ViewController: UIViewController {
var task: String = ""
var tasks: String = ""
var DMID: String = "123456789"
var RECORDID: String = "PCA12345D"
var First : String = "Leah"
var Last : String = "Schmidt"
var Company: String = "Lab Cab Inc"
var Address1 : String = " 5442 Appaloosa Way"
var Address2 : String = "First Floor"
var City : String = "Loma Linda"
var State : String = "Missouri"
var Postalcode : String = "64804"
var Country: String = "USA"
var Sender:String = "Annie"
var Frontimage : String = "Picture of Roo"
var Backtext : String = "\nHi Leah\n Here is a photo of ROO\n Love\n Leah\n"
var Accentimage : String = " NO Accentimage"
var Backimage : String = "NO Backimage"
@IBOutlet var webview: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
let newLine = "\(DMID),\(RECORDID),\(First),\(Last),\(Company),\(Address1),\(Address2),\(City), \(State), \(Postalcode), \(Country),\(Sender),\(Frontimage),\(Backtext),\(Accentimage),\(Backimage),\n"
csvText = newLine
print(csvText)
//
// Do any additional setup after loading the view, typically from a nib.
// webview.loadRequest(NSURLRequest(url: NSURL(string: "https://github.com/vigneshuvi/SwiftCSVExport/blob/master/README.md")! as URL) as URLRequest)
// CSVExport.export.directory = "/Library/CSVFile" // "SampleSwift/Exports" //
print(csvText)
// First User Object
let user1:NSMutableDictionary = NSMutableDictionary()
user1.setObject("123456789", forKey: "DMID" as NSCopying); //required
user1.setObject("Record ID", forKey: "RECORDID" as NSCopying); //required
user1.setObject("Firstname", forKey: "First" as NSCopying); //required
user1.setObject("Lastname", forKey: "Last" as NSCopying); //required
user1.setObject("Company", forKey: "Company" as NSCopying); //required
user1.setObject("Address1", forKey: "Address1" as NSCopying); //required
user1.setObject("Address2", forKey: "Address2" as NSCopying); //optional
user1.setObject("City", forKey: "City" as NSCopying); //required
user1.setObject("State", forKey: "State" as NSCopying); //required
user1.setObject("Postalcode", forKey: "Postalcode" as NSCopying); //required
user1.setObject("Country", forKey: "Country" as NSCopying); //optional
user1.setObject("Sender", forKey: "Sender" as NSCopying); //optional
user1.setObject("Front Image", forKey: "Frontimage" as NSCopying); //required
user1.setObject("Back Text", forKey: "BackText" as NSCopying); //optional
user1.setObject("Accent Image", forKey: "Accentimage" as NSCopying); //optional
user1.setObject("Back Image", forKey: "Backimage" as NSCopying); //optional
// // CSV fields Array adds fields into columns of CSV array
// let fields:NSMutableArray = NSMutableArray()
// fields.add("DMID");
// fields.add("RecordID");
// fields.add("First");
// fields.add("Last");
// fields.add("Company");
// fields.add("Address1");
// fields.add("Address2");
// fields.add("City");
// fields.add("State");
// fields.add("Postalcode");
// fields.add("Country");
// fields.add("Sender");
// fields.add("Frontimage");
// fields.add("Backtext");
// fields.add("Accentimage");
// fields.add("Backimage");
//
// CSV rows Array
let data:NSMutableArray = NSMutableArray()
data.add(user1);
// // Able to convert JSON string into CSV.
// let string = "[{\"name\":\"Tom\",\"email\":\"twglodek@gmail.com\"},{\"name\":\"vinoth\",\"email\":\"vinoth@gmail.com\"}]";
//
// let filePath:String = exportCSV("userlist", fields:["name","email"], values:data);
let filePath:String = SwiftCSVExport.exportCSV("userlist1",fields: ["DMID", "RecordID", "First", "Last", "Company","Address1", "Address2", "City", "State", "Postalcode", "Country", "Sender","Frontimage", "Backtext", "Accentimage","Backimage"],values: data);
print(filePath)
//
let fileDetails = readCSV(filePath);
if fileDetails.allKeys.count > 0 {
loggly(LogType.Info, dictionary: fileDetails)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
var csvText = "DMID, RecordID, First, Last, Street,Apt., City, State, Postalcode\n"
}
… On Nov 6, 2017, at 8:57 AM, Vignesh ***@***.***> wrote:
@DogandElk <https://github.com/dogandelk> , Can you please provide your sample code? I will help you on this. I am currently working Swift 4 migration. Please add sample code here!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0z8kAX2lBXYheFUvzYP1OJPwDtabks5szx5SgaJpZM4QSD98>.
|
Thanks.
I commented out the \n and still receive this improperly formatted info in the userlist1.csv file
DMID
RecordID
First
Last
Company
Address1
Address2
City
State
Postalcode
Country
Sender
Frontimage
Backtext
Accentimage
Backimage
City
Back Image
Back Text
Address2
Firstname
State
Postalcode
Lastname
Company
Accent Image
Record ID
Sender
123456789
Front Image
Country
Address1
… On Nov 6, 2017, at 9:29 AM, Vignesh ***@***.***> wrote:
@DogandElk <https://github.com/dogandelk>
Hi,
var DMID: String = "123456789"
var RECORDID: String = "PCA12345D"
var First : String = "Leah"
var Last : String = "Schmidt"
var Company: String = "Lab Cab Inc"
var Address1 : String = " 5442 Appaloosa Way"
var Address2 : String = "First Floor"
var City : String = "Loma Linda"
var State : String = "Missouri"
var Postalcode : String = "64804"
var Country: String = "USA"
var Sender:String = "Annie"
var Frontimage : String = "Picture of Roo"
var Backtext : String = "Hi Leah" // "\nHi Leah\n Here is a photo of ROO\n Love\n Leah\n" - Issue
var Accentimage : String = " NO Accentimage"
var Backimage : String = "NO Backimage"
// First User Object
let user1:NSMutableDictionary = NSMutableDictionary()
user1.setObject(DMID, forKey: "DMID" as NSCopying); //required
user1.setObject(RECORDID, forKey: "RecordID" as NSCopying); //required
user1.setObject(First, forKey: "First" as NSCopying); //required
user1.setObject((Last), forKey: "Last" as NSCopying); //required
user1.setObject(Company, forKey: "Company" as NSCopying); //required
user1.setObject(Address1, forKey: "Address1" as NSCopying); //required
user1.setObject(Address2, forKey: "Address2" as NSCopying); //optional
user1.setObject(City, forKey: "City" as NSCopying); //required
user1.setObject(State, forKey: "State" as NSCopying); //required
user1.setObject(Postalcode, forKey: "Postalcode" as NSCopying); //required
user1.setObject(Country, forKey: "Country" as NSCopying); //optional
user1.setObject(Sender, forKey: "Sender" as NSCopying); //optional
user1.setObject(Frontimage, forKey: "Frontimage" as NSCopying); //required
user1.setObject(Backtext, forKey: "BackText" as NSCopying); //optional
user1.setObject(Accentimage, forKey: "Accentimage" as NSCopying); //optional
user1.setObject(Backimage, forKey: "Backimage" as NSCopying); //optional
// CSV rows Array
let data:NSMutableArray = NSMutableArray()
data.add(user1);
let filePath:String = SwiftCSVExport.exportCSV("userlist1",fields: ["DMID", "RecordID", "First", "Last", "Company","Address1", "Address2", "City", "State", "Postalcode", "Country", "Sender","Frontimage", "Backtext", "Accentimage", "Backimage"],values: data);
print(filePath)
//
let fileDetails = readCSV(filePath);
if fileDetails.allKeys.count > 0 {
loggly(LogType.Info, dictionary: fileDetails)
}
Try with this. "\n" broke this CSV file
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0wEWGQWXIRU_JLdxBeNlBKjzEQPjks5szyXGgaJpZM4QSD98>.
|
Here is the userlist1.csv file that gets created
… On Nov 6, 2017, at 9:41 AM, kedolg ***@***.*** ***@***.***>> wrote:
Thanks.
I commented out the \n and still receive this improperly formatted info in the userlist1.csv file
DMID
RecordID
First
Last
Company
Address1
Address2
City
State
Postalcode
Country
Sender
Frontimage
Backtext
Accentimage
Backimage
City
Back Image
Back Text
Address2
Firstname
State
Postalcode
Lastname
Company
Accent Image
Record ID
Sender
123456789
Front Image
Country
Address1
> On Nov 6, 2017, at 9:29 AM, Vignesh ***@***.*** ***@***.***>> wrote:
>
> @DogandElk <https://github.com/dogandelk <https://github.com/dogandelk>>
> Hi,
>
> var DMID: String = "123456789"
> var RECORDID: String = "PCA12345D"
> var First : String = "Leah"
> var Last : String = "Schmidt"
> var Company: String = "Lab Cab Inc"
> var Address1 : String = " 5442 Appaloosa Way"
> var Address2 : String = "First Floor"
> var City : String = "Loma Linda"
> var State : String = "Missouri"
> var Postalcode : String = "64804"
> var Country: String = "USA"
> var Sender:String = "Annie"
> var Frontimage : String = "Picture of Roo"
> var Backtext : String = "Hi Leah" // "\nHi Leah\n Here is a photo of ROO\n Love\n Leah\n" - Issue
> var Accentimage : String = " NO Accentimage"
> var Backimage : String = "NO Backimage"
>
> // First User Object
> let user1:NSMutableDictionary = NSMutableDictionary()
>
> user1.setObject(DMID, forKey: "DMID" as NSCopying); //required
> user1.setObject(RECORDID, forKey: "RecordID" as NSCopying); //required
> user1.setObject(First, forKey: "First" as NSCopying); //required
> user1.setObject((Last), forKey: "Last" as NSCopying); //required
> user1.setObject(Company, forKey: "Company" as NSCopying); //required
> user1.setObject(Address1, forKey: "Address1" as NSCopying); //required
> user1.setObject(Address2, forKey: "Address2" as NSCopying); //optional
> user1.setObject(City, forKey: "City" as NSCopying); //required
> user1.setObject(State, forKey: "State" as NSCopying); //required
> user1.setObject(Postalcode, forKey: "Postalcode" as NSCopying); //required
> user1.setObject(Country, forKey: "Country" as NSCopying); //optional
> user1.setObject(Sender, forKey: "Sender" as NSCopying); //optional
> user1.setObject(Frontimage, forKey: "Frontimage" as NSCopying); //required
> user1.setObject(Backtext, forKey: "BackText" as NSCopying); //optional
> user1.setObject(Accentimage, forKey: "Accentimage" as NSCopying); //optional
> user1.setObject(Backimage, forKey: "Backimage" as NSCopying); //optional
>
>
> // CSV rows Array
> let data:NSMutableArray = NSMutableArray()
> data.add(user1);
>
>
> let filePath:String = SwiftCSVExport.exportCSV("userlist1",fields: ["DMID", "RecordID", "First", "Last", "Company","Address1", "Address2", "City", "State", "Postalcode", "Country", "Sender","Frontimage", "Backtext", "Accentimage", "Backimage"],values: data);
>
> print(filePath)
> //
> let fileDetails = readCSV(filePath);
> if fileDetails.allKeys.count > 0 {
> loggly(LogType.Info, dictionary: fileDetails)
> }
> Try with this. "\n" broke this CSV file
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub <#4 (comment) <#4 (comment)>>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0wEWGQWXIRU_JLdxBeNlBKjzEQPjks5szyXGgaJpZM4QSD98 <https://github.com/notifications/unsubscribe-auth/AfEH0wEWGQWXIRU_JLdxBeNlBKjzEQPjks5szyXGgaJpZM4QSD98>>.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfpLyxpLYpTdGOMO3X6ruJC6OqCQJ2qGks5szyiQgaJpZM4QSD98>.
|
FYI, I am using Xcode 9.1 and Swift 4
… On Nov 6, 2017, at 9:45 AM, Corey and Tom Glodek ***@***.***> wrote:
Here is the userlist1.csv file that gets created
> On Nov 6, 2017, at 9:41 AM, kedolg ***@***.*** ***@***.***>> wrote:
>
> Thanks.
>
> I commented out the \n and still receive this improperly formatted info in the userlist1.csv file
> DMID
> RecordID
> First
> Last
> Company
> Address1
> Address2
> City
> State
> Postalcode
> Country
> Sender
> Frontimage
> Backtext
> Accentimage
> Backimage
> City
> Back Image
> Back Text
> Address2
> Firstname
> State
> Postalcode
> Lastname
> Company
> Accent Image
> Record ID
> Sender
> 123456789
> Front Image
> Country
> Address1
>
> > On Nov 6, 2017, at 9:29 AM, Vignesh ***@***.*** ***@***.***>> wrote:
> >
> > @DogandElk <https://github.com/dogandelk <https://github.com/dogandelk>>
> > Hi,
> >
> > var DMID: String = "123456789"
> > var RECORDID: String = "PCA12345D"
> > var First : String = "Leah"
> > var Last : String = "Schmidt"
> > var Company: String = "Lab Cab Inc"
> > var Address1 : String = " 5442 Appaloosa Way"
> > var Address2 : String = "First Floor"
> > var City : String = "Loma Linda"
> > var State : String = "Missouri"
> > var Postalcode : String = "64804"
> > var Country: String = "USA"
> > var Sender:String = "Annie"
> > var Frontimage : String = "Picture of Roo"
> > var Backtext : String = "Hi Leah" // "\nHi Leah\n Here is a photo of ROO\n Love\n Leah\n" - Issue
> > var Accentimage : String = " NO Accentimage"
> > var Backimage : String = "NO Backimage"
> >
> > // First User Object
> > let user1:NSMutableDictionary = NSMutableDictionary()
> >
> > user1.setObject(DMID, forKey: "DMID" as NSCopying); //required
> > user1.setObject(RECORDID, forKey: "RecordID" as NSCopying); //required
> > user1.setObject(First, forKey: "First" as NSCopying); //required
> > user1.setObject((Last), forKey: "Last" as NSCopying); //required
> > user1.setObject(Company, forKey: "Company" as NSCopying); //required
> > user1.setObject(Address1, forKey: "Address1" as NSCopying); //required
> > user1.setObject(Address2, forKey: "Address2" as NSCopying); //optional
> > user1.setObject(City, forKey: "City" as NSCopying); //required
> > user1.setObject(State, forKey: "State" as NSCopying); //required
> > user1.setObject(Postalcode, forKey: "Postalcode" as NSCopying); //required
> > user1.setObject(Country, forKey: "Country" as NSCopying); //optional
> > user1.setObject(Sender, forKey: "Sender" as NSCopying); //optional
> > user1.setObject(Frontimage, forKey: "Frontimage" as NSCopying); //required
> > user1.setObject(Backtext, forKey: "BackText" as NSCopying); //optional
> > user1.setObject(Accentimage, forKey: "Accentimage" as NSCopying); //optional
> > user1.setObject(Backimage, forKey: "Backimage" as NSCopying); //optional
> >
> >
> > // CSV rows Array
> > let data:NSMutableArray = NSMutableArray()
> > data.add(user1);
> >
> >
> > let filePath:String = SwiftCSVExport.exportCSV("userlist1",fields: ["DMID", "RecordID", "First", "Last", "Company","Address1", "Address2", "City", "State", "Postalcode", "Country", "Sender","Frontimage", "Backtext", "Accentimage", "Backimage"],values: data);
> >
> > print(filePath)
> > //
> > let fileDetails = readCSV(filePath);
> > if fileDetails.allKeys.count > 0 {
> > loggly(LogType.Info, dictionary: fileDetails)
> > }
> > Try with this. "\n" broke this CSV file
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub <#4 (comment) <#4 (comment)>>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0wEWGQWXIRU_JLdxBeNlBKjzEQPjks5szyXGgaJpZM4QSD98 <https://github.com/notifications/unsubscribe-auth/AfEH0wEWGQWXIRU_JLdxBeNlBKjzEQPjks5szyXGgaJpZM4QSD98>>.
> >
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfpLyxpLYpTdGOMO3X6ruJC6OqCQJ2qGks5szyiQgaJpZM4QSD98>.
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH04Z0qI3bpaLoJ-r1NIxwZiDME51vks5szymagaJpZM4QSD98>.
|
@DogandElk, I have fixed that issue. Will release the build by tomorrow! pod 'SwiftCSVExport', :git => 'https://github.com/vigneshuvi/SwiftCSVExport.git', :tag => '1.0.4' Try to install pod from this version. |
@DogandElk , Please refer your example. Few typos mistake there in your keys. |
Hi !
Thanks for fixing the problem. I will update the pod file tomorrow and let you know if it worked.
Thank you also for noticing some typos. I only found two. Were there any more that you identified ?
I'll look forward to updating the pod SwiftCSVExport version 1.04 tomorrow.
Once I get the formatting correct, I will want to have the file send via a GET command or a Simple Post to a third party.
Is that functionality in your code somewhere ?
Thanks again and Great Work !
… On Nov 6, 2017, at 10:32 AM, Vignesh ***@***.***> wrote:
@DogandElk <https://github.com/dogandelk> , Please refer your example. Few typos mistake there in your keys.
https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift <https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0-ZiXOh8oichqMwS0hAhz4nxsbciks5szzSpgaJpZM4QSD98>.
|
Hi Again,
I see you placed my code on your repository. I would appreciate if it be removed.
Thank you.
… On Nov 6, 2017, at 12:46 PM, kedolg ***@***.*** ***@***.***>> wrote:
Hi !
Thanks for fixing the problem. I will update the pod file tomorrow and let you know if it worked.
Thank you also for noticing some typos. I only found two. Were there any more that you identified ?
I'll look forward to updating the pod SwiftCSVExport version 1.04 tomorrow.
Once I get the formatting correct, I will want to have the file send via a GET command or a Simple Post to a third party.
Is that functionality in your code somewhere ?
Thanks again and Great Work !
> On Nov 6, 2017, at 10:32 AM, Vignesh ***@***.*** ***@***.***>> wrote:
>
> @DogandElk <https://github.com/dogandelk <https://github.com/dogandelk>> , Please refer your example. Few typos mistake there in your keys.
>
> https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift <https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift> <https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift <https://github.com/vigneshuvi/SwiftCSVExport/blob/master/Examples/SampleSwift/SampleSwift/ViewController.swift>>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub <#4 (comment) <#4 (comment)>>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfEH0-ZiXOh8oichqMwS0hAhz4nxsbciks5szzSpgaJpZM4QSD98 <https://github.com/notifications/unsubscribe-auth/AfEH0-ZiXOh8oichqMwS0hAhz4nxsbciks5szzSpgaJpZM4QSD98>>.
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AfpLyykw0g6Vht4O6cZDUntI1Y9l5n9sks5sz1P6gaJpZM4QSD98>.
|
New version 1.0.5 released. Release Note: https://github.com/vigneshuvi/SwiftCSVExport/releases/tag/1.0.5 |
I am getting strange formatting
The text was updated successfully, but these errors were encountered: