From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Lookout

cancel
Showing results for 
Search instead for 
Did you mean: 

EMAILING DAILY CSV FILES

okay.....my spreadsheet object logs data to batch report.csv daily.....it is stored under c:/Program Files/National Instruments/Lookout 6.0/2006/month/day/batch report.csv......i want the mailer object to email this file daily at some time.....how do i get it to look for that particulars day's file to attach to the email....thanks...randy
0 Kudos
Message 1 of 16
(5,523 Views)
comeon'....i'm not smart enough to figure this out by myself....i know some of you guys know how to do this....thanks..randy
0 Kudos
Message 2 of 16
(5,503 Views)
The problem is how to get the current date and time. There is no direct way in Lookout to get those values, so follow this kb step by step.
After that, you can construct the file path for the attachment.
Ryan Shi
National Instruments
0 Kudos
Message 3 of 16
(5,474 Views)
lordy.....have mercy
0 Kudos
Message 4 of 16
(5,453 Views)
can you give me an example of this line....."Use mathematical operations/expressions to calculate month and/or day of month."
can't figure out what to use for this...thanks..randy
0 Kudos
Message 5 of 16
(5,377 Views)
The following two expressions will get you the current month, date, and time:

Exp1 = text(now(Pb1),"yyyy-mm-dd")
Result: "2006-08-17"

Exp2 = replace(replace(Exp1,5,1,"/"),8,1,"/")
Result: "2006/08/17"

The Exp2 is just to replace the "-" with the "/". You can replace the PushButton Pb1 with whatever timer your email is using for sending the daily email.

Hope this helps.

-Khalid
0 Kudos
Message 6 of 16
(5,371 Views)
i hate to be so dumb about this but i'll just keep on trying......thanks Khalid....the 2006/08/17 is getting closer to what i need...here is where my csv files go everyday and thanks to ryan i finally got my month and day comboboxes with a pushbutton to work with the run command and this expression
"C:\Program Files\Microsoft Office\Office10\Excel.Exe "&"""c:\Program Files\National Instruments\Lookout 6.0\2006\"&left(DailyTotalsMonthCombobox.properties.selectedItem,3)&"\"&DailyTotalsDayCombobox.properties.selectedItem&"\dailytotals.csv"""
i pull up the month and day and push the button and that day's file opens with the batch weights so far for that day.

it looks for a csv file named dailytotals.csv in a different folder for each day so i guess i am going to have to get the date into 2006/aug/17 format somehow....because it logs the month by the first three letters of that particular month...thanks...randy
0 Kudos
Message 7 of 16
(5,348 Views)
Randy,

You can use the "choose" function to convert the month-numbers into 3-character month names, like this:

Exp3=replace(Exp2,6,2,choose(mid(Exp2,6,2),"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"))

So, these 3 expressions (first two from my earlier post) should give you the date in the following format: 2006/Aug/19.

[rant]
It's about time NI improved this mess -- it's kinda lame that the Spreadhseet object creates files using a set directory-structure, and there are no simple ways to reconstruct this directory structure back!

Also, the Run command with all its mysterious quotes and double-quotes really could use some simplification. Or, maybe we should just be thankful for not being asked to use Assembly language?? On second thoughts that might actually be easier....
[/rant]

-Khalid

Message Edited by Khalid on 08-19-2006 03:33 PM

Message 8 of 16
(5,341 Views)
first of all Khalid let me thank you for your intelligence and great help.......so far i have your three expressions down except in Exp2 i changed the "/" to "\" thinking that would put the result in the exact format i need    2006\aug\22  which it does when i drag it out on the screen......so far i have tried several revisions of this but every time i get "error opening attachment".......what am i doing wrong now...
"C:\Program Files\National Instruments\Lookout 6.0\"&EmailExpressions\Exp3&"\Nashville Batch Report.csv"""
0 Kudos
Message 9 of 16
(5,294 Views)
Hi Randy,

You will want to enclose the "\" between the EmailExpressions and Exp3 in double-quotes first and then with two ampersands ("&"), like this:

...6.0\"&EmailExpressions & "\" & Exp3&"\Nashville...

The best way to debug this is to insert an Expression (from the Insert menu) on a Panel and paste the entire string. You should now see the final built string.

Hope this helps.

-Khalid

Message Edited by Khalid on 08-22-2006 12:57 PM

0 Kudos
Message 10 of 16
(5,262 Views)