Creating a csv file, then send file contains an attachment...

I have a question to multiple segment...

I need to create a csv file and then attach this file to an e-mail. I have a general idea on how to get it going, but before I start coding I have a few questions...

These are the classes / pseudo-code...

  1. Create file, replace an existing one because just one instance of this file...

    QString csvFile = QDir::homePath() "/ mycsvFileAttachement.csv";
    QFile newFile (csvFile);

  2. Data through the loop model and write each record in the file

    Not sure how to do this part with C++. Any sample to show how to achieve?

  3. Create a new email and attach the newly created file... So, for this piece I was looking @ the MessageBuilder class...

    https://developer.BlackBerry.com/Cascades/reference/bb__pim__message__messagebuilder.html

    It would have been so much simpler to have the possibility to use the invoke framework to push a new message, user interface, but from what I've read, it is basically impossible to hang an attachment via the invoke framework. Is this correct?

  4. Display the user interface for new Message and wait until the message is pulled off by user

    https://github.com/BlackBerry/Cascades-samples/tree/master/messages

    To send an email, the example message gives me all the code necessary to accomplish this feature. But I also want to provide a contact selector the user, any sample that shows how to do this?

If the file save location is important you want to prompt the user in the dialog box a file selector.  They can save documents or the SD card, etc.  If not, then create a temporary file, i.e. do not use QDir::homePath();

filePicker = new FilePicker();
filePicker-> setType(FileType:: other);

connect to this kind can at least make a deleteLater()

Connect (filePicker, signal (Canceled (()), this, slot (filePickerCanceledSlot ()));

sign in here to get the name of the file to save on
Connect (filePicker, SIGNAL (fileSelected(const QStringList &)),
This, SLOT (filePickerSelectedSlot (const QStringList)));

What about writing in the file, the QTextStream use for you help.  Do something like this:

QFile file (fileName);
bstatus = file.open (QIODevice::WriteOnly);
If (! bstatus) {}
qWarning()< "failed="" to="" open="" file="" "=""><>
return;
}

QTextStream out (&file);)

QListIterator iter (myObjets);

{whilte (ITER.hastNext ()}

MO = iter.next ();

the < mo-=""> field1 < ","=""> < mo-=""> Field2< ","="" ....=""><>

}

file-> close();

I don't know how to send it as an attachment. You can search for it on this forum because it's a frequently asked question.  Myself I could never get send attachment to work the way I wanted so abandoned.  And decided the user can only send the file as an attachment if they want to.

I hope it is of some value.

Tags: BlackBerry Developers

Similar Questions

  • Create a csv file and send it in an e-mail message

    In coldfusion, is it possible to create a csv file and send it in an e-mail, without ever save this file on the hard drive?

    Lol you can't attach a file to an e-mail, unless the file has been created.

    We deal with this situation by creating the file in a directory designated for dynamically created files.  Then we have a scheduled task that cleans all files over a certain age, every night.

  • Not possible to export a list of virtual machines that are created in the past 7, 30, 120 and 180 days since an imported csv file containing the date of creation of virtual machine

    Not possible to export a list of virtual machines that are created in the past 7, 30, 120 and 180 days since an imported csv file containing the date of creation of virtual machine. My questions is the correct statement to the variable: $VmCreated7DaysAgo: $_CreatedOn "-lt" $CDate7.

    # #SCRIPT_START

    $file = "C:\Users\Admin\Documents\WindowsPowerShell\08-18-2014\VM-Repo.csv".

    $Import = import-csv $file

    $VMCreatedLast7RDayRepoFile = "C:\Users\Admin\Documents\WindowsPowerShell\08-18-2014\Last7Days.csv".

    $start7 = (get-Date). AddMonths(-1)

    $CDate7 = $start7. ToString('MM/dd/yyyy')

    $VmCreated7DaysAgo = $Import | Select-object - property name, Powerstate, vCenter, VMHost, Cluster, file, Application, CreatedBy, CreatedOn, NumCpu, MemoryGB | Where-Object {$_.} CreatedOn - lt $CDate7} | Sort-Object CreatedOn

    $TotalVmCreated7DaysAgo = $VmCreated7DaysAgo.count

    $VmCreated7DaysAgo | Export-Csv-path $VMCreatedLast7RDayRepoFile - NoTypeInformation - UseCulture

    Write-Host "$TotalVmCreated7DaysAgo VMs created in 7 days" - BackgroundColor Magenta

    Invoke-Item $VMCreatedLast7RDayRepoFile

    # #SCRIPT_END

    You can use the New-Timespan cmdlet in the Where clause, it returns the time difference between 2 DateTime objects.

    An example of this cmdley

    New-TimeSpan-start (Get-Date). AddDays(-7)-end (Get-Date). Select days - ExpandProperty

    In your case, you could do

    Where {(New Timespan-démarrer ([DateTime] $_.))} CreatedOn) - end $start7). {7 days - gt}

    But beware of negative numbers.

  • How create the CSV file delimited by tabs using ORACLE utl_file?

    How create the CSV file delimited by tabs using ORACLE utl_file? Please provide the code sampl.

    This isn't a problem with Oracle, it is a problem with the way you open the data in Microsoft Excel.

    In Excel, you want (depending on your version may vary slightly)...

    Office 2010...

    1. go in the Ribbon "Data".

    2. click on 'text '.

    3. Locate and select your file, and then click "import."

    4 step 1 of the wizard - choose "Delimited", then click on "next >".

    5. step 2 of the wizard - choose "Tab" as the delimiter and click on "next >".

    6. step 3 of the wizard - define types of column as needed (if necessary) and click on "Finish".

    7. check where you want the data in the worksheet.

    Data is loading now in single cells as you expect.

    If you just double-click the CSV, Excel is apparently assuming that it will be separated by commas and does not recognize tabs as separators, unlike when you rename the file with a .xls extension where it examines the file, complains that it is not a content .xls and asks you to confirm that you want to continue loading and then intelligently recognizes the tabs and the format for you.

    As I said, not a problem with Oracle, just a problem with the MS Excel software.

  • Orchestrator 5.1 REPORT-all the virtual machines in the data center and create a CSV file

    Hello

    What I basically want to do is create a report CSV of all virtual machines in the data center with various information (VMname, domain name FULL, IPaddress, status, data warehouses, tools etc...).  The export list in the client feature is insufficient (especially for any KPI report).

    Problem: (workflow is still under construction so real email send does not not and need to clean the code)

    I am stuck at the part of the creation of a table that can be parsed correctly in the CSV file.  2 ways I've tried will produce a report of single object or combine all of the table into a single string (where I am now).  I think the main problem I have is that I have to create a 2D within my service to push toward the final table that is written to the CSV format.  Basically, I do not understand how to push my variables in a loop of a table.

    Any help or assistance?

    Thank you

    B

    BOOM!

    Added some comments, removed the hardcoded in the csv temp file, deleted path the hardcoded port 25 for SMTP - mail settings should come from the configuration of the MAIL plug-in. And fixed / confirmed that the workflow now includes the attachment for e-mail and ends with success!

  • Use OdiOutFile to create the csv file

    Hello
    I am trying to write a csv file by using the file ODIOutFile.The is created with success, but all EI tags column coming in one line.
    I need to write different columns given different columns in csv. Kindly guide me which character I include as up to meet my requirement.

    Thank you
    Ritika

    Ritika, as mentioned in the email, this error occurs because you did not mention something in the command on the source, in the jython code, we allocate the technology and the schema required so that we must manually provide all the required parameters and ODI can pick up from the root.

    Also once you mentioned are, of course, call you this code after you odisqlunload else you don't have the header, since odisqlunload erases the file and write. Hope that this help please let me know if you have still problems with the program and also showed me a sample of the program odisqunload and header as well as the results, only a few responses back.

    Thank you
    Dev

  • How to write the char value as it is in the CSV file

    Hello world

    I create a csv files containing details of the inventory of all products. I am able to create the CSV file utl concepts. My problem starts after the csv file is being created.
    some of the product numbers (although I mean the product number, it is varchar2 data type in the table) is like this 3rd-12, 3rd-54 and so on. I have totally 23 numbers of product like this.
    When the user opens the csv file, it evolves to numbers like this 3.00E - 12, 3.00E - 54. I want to keep the product number because it is like the char value. I tried many methods of submissions and concat.
    But none of them works for me.

    I use oracle 9i.

    Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With partitioning, OLAP and Oracle Data Mining options
    Release 9.2.0.7.0 - Production jserver

    Please help me solve this problem.

    Thanks in advance,

    Vimal...

    >
    When the user opens the csv file, it evolves to numbers like this 3.00E - 12, 3.00E - 54. I want to keep the product number because it is like the char value. I tried many methods of submissions and concat.
    But none of them works for me.
    >
    This is because in Excel, the default format for all cells is "Général" and this format is this:
    >
    Format 'Général' Converts numeric values to numbers, values from date to date, and all remaining values to text.
    >
    If you open a file with CSV extension, then each cell uses the format "General".

    You have two choices, and two of them will require the user to go through the text import wizard dialog boxes.

    Save the file with another extension, for example "txt". Then when a user opens the file they will have to select "Delimited" for the file type in step 1 of the wizard and select "next". They will then choose "Comma" as the separator at step 2 of the wizard and select "next". They must then select 'Text' to the data format column in step 3 of the wizard for these two columns, and then select "Finish".

    The other 'Data-> external data' option in the menu and involves the same selections in the wizard.

    You can chat with your users the ability to use a standard for these two columns prefix so that they will be treated as text. If you use "-" as a prefix data will display correctly.

  • creating CSV files - output contains comma - work around?

    Greetings,

    It is:

    Is there a way to bypass the databases containing commas

    When you create csv files?

    I have the process down to create a .csv file and stored on the server and

    or by e-mail to go out. The problem I have is that one of the db fields being withdrawn

    the database has a comma in there and so cause problems for me in

    creation of the csv file.

    Fields of DB:

    -emp_number

    -emp_name (name, first name)

    -activity_code

    -report_date

    -time_total

    When the file is created it recognizes the comma in the emp_name field

    and separates the name and surname and creates separate

    columns for them in the CSV files that do not match with the db field

    names in the row 1 of csv.

    I already searched the forum to see if this has been asked before. Or the other

    my eyes is too crossed everyone reading or I'm not in the

    appropriate search criteria.

    Any help will be greatly appreciated.

    Leonard

    double quotes the data part.

  • Create the list of virtual machines to exclude the script through .csv file?

    Hello

    I have a script that runs all day off hours to check my VMs respect some things, like having the option to 'VM tools upgrade policy' checked. The script will export a list of virtual machines that DO NOT have this option enabled and then later to fix the problem. Now, for some specific VMS, I don't want to have the option active and want to exclude them from this review. I try to add a list of these virtual machines I want to exclude from my check script of VMTools_UpgradePolicy via a .csv file containing their names. Here's what I have:

    ##############################################
    #VMTools update during the feeding cycle - report
    ##############################################
    function Report_VMTools_UpgradePolicy {}
    $list = import-Csv "C:\VMware\PowerCLI\Scripts\EXCLUDE LIST\EXCLUDE_vmtools_upgradepolicy.csv".
    foreach ($entry in $list) {$exclude = Get-VM-name $entry. Name}
    $vms = get - Vm | where {$_.} Name - not $exclude - and (Get-View-Id $_.) {ID). Config.Tools.ToolsUpgradePolicy - eq 'manual'} | Select name
    $vms | Export-Csv "C:\VMware\PowerCLI\Scripts\REPORTS\vmtools_upgradepolicy.csv" - NoTypeInformation
    }

    The content of the EXCLUDE_vmtools_upgradepolicy.csv is as follows:

    'Name '.
    "VM1.
    "VM2.

    "VM3.

    I try to get all the virtual machines in my environment who have the ToolsUpgradePolicy - eq 'manual' (unchecked), AND which do not match any of the names on my list of exclusions (VM1, VM2, VM3). My script so far will do what I want, except that only the last entry in my list of exclusions will take into account. VM1 and VM2 will still be reported as VMs that need to be addressed.

    I'm not sure that I am taking the right approach with this, I will continue to seek a solution for what I want, but any help would be appreciated! I prefer to make my list of exclusion to a separate file, for example "EXCLUDE_vmtools_upgradepolicy.csv", because I want that other administrators to be able to just open this .csv file and add virtual machines to this list without having to touch my scripts.

    Thank you!

    Vince

    Hi Vince,.

    It is like that I think because of your statement:

    foreach ($entry in $list) {$exclude = Get-VM-name $entry. Name} -> it
    $vms = get - Vm | where {$_.} Name - not $exclude - and (Get-View-Id $_.) {ID). Config.Tools.ToolsUpgradePolicy - eq 'manual'} | Select name
    $vms | Export-Csv "C:\VMware\PowerCLI\Scripts\REPORTS\vmtools_upgradepolicy.csv" - NoTypeInformation
    }

    $exclude is a variable that contains only 1 entry., that's why you see only the last element inside. It will not be an array.

    foreach ($entry in $list) {[string []]+ $exclude = Get-VM-name $entry.} Name}

    This will fill $exclude table with entries of string that will contain the names of virtual machine.

    And when you will be comparing. I think you should use

    where {$exclude - notcontains $_.} Name - and... the rest

    Kind regards

    Greg

  • Stored procedure to create the table .csv file

    Hi all
    I have a table with 4 columns and 10 rows. Now I need a stored procedure to create a file .csv from the data in the table. Here the script to create a table and insert the line.

    Create table emp (emp_id number (10), emp_name varchar2 (20), Department varchar2 (20), number (10)) of salary;

    Insert into emp values ('1', 'AAAAA', '' SALES, 10000');
    Insert into emp values ('2', 'BATH', 'MARKETING', '8000');
    Insert into emp values ('3', 'CCCCC', '' SALES, 12000');
    Insert into emp values ('4', 'JAMES', 'FINANCE', '10000');
    Insert into emp values ('5', 'EEEEE', '' SALES, 11000');
    Insert into emp values ('6', 'FIRE', 'MANAGER', '90000');
    Insert into emp values ('7', 'GEORGE', '' SALES, 12000');
    Insert into emp values ('8', 'HAROLD', 'FINANCE', '14000');
    Insert into emp values ('9', 'IIIII', '' SALES, 20000');
    Insert into emp values ('10', 'GG', 'FINANCE', '21000');
    commit;

    Now I need a stored procedure to create a .csv file in my local location. Please let me know if you need more details...

    A few tips:
    http://www.Oracle-base.com/articles/9i/GeneratingCSVFiles.php
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html
    also, doing a search on this forum or http://asktom.oracle.com will give you many clues.

    in my local location .csv file.

    What is your "local position"?
    A client machine? The database server machine?
    Which version of the database you use?
    (the result of: select * version of $ v ;))

  • Merger of csv files

    Hi all

    I use LV to create multiple csv files, then I want to merge together in a CSV file (so basically csvfile1 would be csvfile2 of 1-3, columns columns 4 and 5, etc..) Is this possible? I found a lot of references that refer to do, but nothing that outright indicates whether it is feasible or not.

    Thanks in advance!

    Laura

    Laura,

    Yes, it's doable.

    It can be messy, depending on the details.  Basically, you need to read each file and convert it into a proper table. Then, you will need to create the final table and place the data of each file in the places of s. Finally, you write the table to the new file.

    Tables in LabVIEW are indexed from scratch, so the first column is column 0.  You suggest that csvfile1 has three columns, while csvfile2 has only two. All files have the same number of lines?  The tables in BT are always rectangular. So if csvfile1 has 3 columns and 10 rows and csvfile2 has 2 columns and 8 rows and you want something else in column zero, your final picture would have at least 6 coulmns and 10 lines. The last two rows in the csvfile2 columns have default values (zero for numeric values).

    Lynn

  • CSV file for importing

    I don't know if this has been discussed, but the import file function is actually a lot of work. I mean, I can create a CSV file of my IP addresses by the export of a third party monitoring tool, but I can't get the SN with her. Why this 'feature' cannot be done with just the IPS without SN? After all, the seed router discovery feature gets the serial number for devices; Why do we need SN under the import?

    Go to management > discover and manage devices

    Select the first option 'discovery by known IP addresses '.

    Copy the IP addresses column in Excel

    Paste IP addresses in the input area. (It seems small but can contain all IP addresses)

    Click on the Add button

    Click on 'Next', change your settings to the appropriate SNMP version and click "Finish".

    Please let me know if this doesn't work if you have other questions.

    Thank you

    Lynden

  • Helps to replace a string in a txt file with a string from a csv file

    Hi all

    I worked on the script following since a few days now, determined to exhaust my own knowledge before asking for help... Unfortunately, it didn't take very long to exhaust my knowledge :-(

    Basically, I need to replace a value in a single file (raw.txt) with the value of another file (userids.csv) when a variable is. Then I released the results of a third file.

    To do this, I divided the "raw" file into variables using the ',' as the separator, the problem is that some variables are intentionally empty, where the fi $variable = "statements.

    It is currently what I want to do but only when the userids.csv file contains a single line. It is obviously because of the foreach ($user in import)... What I need to figure out is how to loop through the file raw.txt, text replacement when a variable in the user ID file is the text in raw.txt... I hope that makes sense?

    The user ID file is in the following format - user, service, Dept that can contain dozens of lines

    I would appreciate any pointers :-)

    See you soon

    # Treatment
    $importraw = get-content i:\raw.txt
    $import = import-csv i:\userids.csv-en-tete UserAccount, functional, Dept

    {foreach ($user in $import)
    $useraccount = $user. UserAccount
    $userfunction = $user. Functional
    $userdept = $user. Dept
    {foreach ($line in $importraw)
    $first, $second, $third, $fourth, $fifth, $sixth, $seventh, $eighth, $ninth = $line - split(",")
    $linesproc = $linesproc + 1
    If ($sixth - eq ") {}
    $temp6 = "6TEMP".
    Write-Host "field Null detected - assigning temporary value:"$temp6 ".
    $sixth = $temp6 # the assignment of a temporary value so that - statement to replace later works
    }
    If ($seventh - eq ") {}
    $temp7 = "7TEMP".
    Write-Host "field Null detected - assigning temporary value:"$temp7 ".
    $seventh = $temp7 # the assignment of a temporary value so that - statement to replace later works
    }
    If ($fifth - eq $user.) UserAccount) {}
    $line - $seventh, replace $user. Dept | Add content i:\Output.txt
    }
    else {}
    $line - $seventh, replace "/ / customer. Add content i:\Output.txt
    }
    }

    }

    Try the attached version.

    The problem, in my opinion, was in nested ForEach loops.

    Instead I've implemented with a lookup table

  • Dr-ip-customizer - Indivdual csv files

    We have a recovery site shared with many groups of protection for different customers - it is possible to have files csv indivdual by protection group? At the moment I get one that includes virtual machines for all protection groups.

    Also, if new virtual machines are added to what I need to create a csv file, edit the file, delete the old file and apply the new file?

    There is an old white paper here:

    http://communities.VMware.com/servlet/JiveServlet/download/11517-2-52454/VMW_09Q2_WP_VCENTER_SRM_EN_P37_R2.PDF

    in the book he walks then you through the idea of having a csv file 'master' for all protected vm but also explains how to make copies of this file you can use to add new protected vm in, remove specific vm from the list.

    essentially using this kind of technique you could split you master file in per-protection group files... it would be a bit labor intensive to reference first of all there is no column in the generated file that shows you the protection group name, so you would need to go through these yourself.

  • Export of objects of the inventory of VC to CSV files

    Can someone help me develop the following script? I would create five CSV files, one file for each of the following objects in a VC inventory specified:

    1. data centers - name, location (e.g., the children of a folder / root?)

    2. cluster - name, location (e.g., the children of a folder / data center?), DRS enabled?, DRS, HA mode?

    3. records - name, location (e.g., the children of a folder / data center / root?)

    4. host - name, location (e.g., the children of a folder / data center?), clustered?

    5. resource Pools - name, location (e.g., children of a cluster / resource pool), information sharing

    This will be useful for a "backup" of the inventory of VC human readable.

    I tried to use Get-inventory but have problems with collecting the parent / child relationships and filter objects by default (for example, root data center, resource pool "resources", etc.)

    Any help is appreciated. Thank you.

    Take a look at this document.

    Contains export and import functions

    http://communities.VMware.com/docs/doc-12182

    -

Maybe you are looking for