This article is for users who wish to change the formatting of Spot and Alert emails sent by LOGic. This article is intended for advanced users. You do not need to know how to program, but should be a patient individual with good basic computer skills.
There is also a file attached to this article that provides simplified spot and alert emails that you can download so as to avoid doing all this.
The formatting of texts and emails are controlled by a database table. By editing this table, you may change the formatting of emails. There is no screen in LOGic for editing this file, so you need to use Logic's Database Commands feature. This feature gives you access to the internals of LOGic, and is most frequently used for mass-changing data. We will begin with a short tutorial on using the Database Commands feature.
As always, we recommend backing everything up before beginning. An easy way to do this is to exit LOGic, and make a copy of your whole LOGic install folder. In particular, you want to keep a copy of spotemail.dbf and spotemail.fpt (located in the logdata folder which is inside your LOGic install folder -- program files (x86)\logic\logdata in most cases). However, you can get it off of your original installation package if you screw it up and fail to make a backup.
There are menu options in the Database Commands window for opening database files and performing some common basic operations. For brevity, this article will use commands that you will type into the Command window. (However, don't hesitate to explore this window's menu options.) To execute a command, type it in the Command window. Press {Enter} to execute it. Let's try it. Type
? datetime()
and press {Enter}. The current date and time is displayed.
All commands you type remain in the Command window and scroll up as you type new commands. You may redo a command by placing the cursor on it and pressing {Enter}. You may modify the command before pressing {Enter}.
Ok, so lets get started. Type
use spotemail
edit
The file will be displayed in an editable window.
Let's take a look at the records and fields in this table. There are separate records for spots and alerts. There are also separate records for HTML and plain-text emails. LOGic, as of this writing, only supports plain-text emails.
The SUBJECT field contains an expression that defines the subject of the email. BODY is a freeform memo field that contains the template that defines the body of the email. It contains expressions enclosed within double-curlybraces.
To see the contents of the Body fields, hold your mouse on top of it (the window must be active). Or open the memo field in an editor by double-clicking it. The edit window opens behind other windows, so a large monitor helps. Drag things around so you can see everything. If you double-click Memo and no window appears, it probably opened behind something.
Also note the HTML, ALERT, and ACTIVE fields. These are logical True/False fields. If ALERT is T, the record defines the format for alerts. Otherwise it defines the format for spots. ACTIVE determines if the record is in use or not. There must be one and only one active record for Alerts. Ditto for Spots.
For this example, let's simplify the Alert email. We can edit the existing record, but we can also create a new record, leaving the factory one in place so we can easily switch back to it if we want to, or keep it around for an example.
To add a new record to the Edit window, type {Ctrl-Y}. (To delete a record, click the little area to the left of the field names). Type
my alert for Descr. LOGic doesn't do anything with this field. It is just for us humans to read. Rather than retype the subject, let's copy and paste the factory alert record. This is the record that has T in Active and ALERT.
We must use the keyboard for this. Hilight the Subject we are copying. Put the cursor in the field and type {Ctrl+A}. Copy to the clipboard by typing {Ctrl+C}. Now place the cursor at the beginning of the Subject field in the new record and paste by typing {Ctrl+V}.
By the way, these keyboard shortcuts for editing are not unique to LOGic, or even Microsoft or Windows. They work in most any application on any computer. They are worth remembering.
To copy the Body, double-click Memo in the factory record, {Ctrl+A){Ctrl+C}, double-click memo for the new record, and {Ctrl+V}. Now close the memo edit window
Finally, be sure to type T for alert in our new record. Enter F for Active in the old alert record, and T for Active in the new record.
Ok, we have finally completed the setup. This is actually the most time-consuming part. The changes will be easy.
Let's start with the subject. It is currently:
Quote:"LOGic alert " + TRIM(spotalertexpr.descr) + " de " + TRIM(spot_by) + ": " + TRIM(call) + " " + unzerofl(freq) + " " + lower(TRIM(comment))
Let's change it to:
Quote:"LOGic alert: " + TRIM(spotalertexpr.descr) + " de " + TRIM(spot_by) + ": " + TRIM(call) + " " + unzerofl(freq)
Just delete some stuff from the end. We are removing the comment from the subject
Now the body. It is currently
Quote:LOGic has received a spot that matches an alert:
Description:{{chr(9)}}{{ALLTRIM(spotalertexpr.Descr)}}
Expression:{{chr(9)}}{{ALLTRIM(spotalertexpr.Expression)}}
Direction:{{chr(9)}}{{unzerofl(direction)}} ({{unzerofl((direction + 180)%360)}} long path)
Posted: {{chr(9)}}{{spot_datet}}
In case you are wondering, all the {{chr(9)}} are tabs.
For the body, we will remove the introductory line and expression, and add the Comment:
Quote:
Description:{{chr(9)}}{{ALLTRIM(spotalertexpr.Descr)}}
Direction:{{chr(9)}}{{unzerofl(direction)}} ({{unzerofl((direction + 180)%360)}} long path)
Comment: {{chr(9)}}{{TRIM(comment)}}
Let's simplify spots too. Create a new record as we did for our new alert. Enter MY SPOT for the Descr. Set Active to T on our new record. Leave ALERT blank or enter F here. Enter F for the factory spot record.
Change the subject from
Quote:"LOGic spot: " + TRIM(award) + " " + alltrim(awardval)+ " de " + TRIM(spot_by) + " : " + TRIM(call) + " " + unzerofl(freq) + " " + lower(TRIM(comment))
to
[quote]lower(trim(award) + " " + trim(subaward) + " " + trim(call) + " " + unzerofl(freq))[quote]
Note that I have used the LOWER() function to display all of the text in lower-case. Lower-case letters take up less of the precious screen real estate on your cell phone.
Leave the Body blank. It is optional. There, you can't get much simpler than that! You might want to do the subject-only trick for Alerts too.
Close the editing window, close the Database Command Window, and open and close the spot log or just restart LOGic. Generate a test spot to see the results of our work.
If LOGic crashes, there is an error in one of your expressions. The error message should be useful in determining the problem. Or, simply restore your copy of spotemail.dbf
For this example, we just deleted some stuff. We didn't discuss the expressions themselves. The expressions work like any other expression used in LOGic for report writing or filtering, and everything in Help about Expressions and Functions applies here.
The attached file is the results of following this article. To use it, simply download, unzip, and and replace your spotemail.dbf and spotemail.fpt files with these new ones. The files are located in the logdata folder which is in the LOGic install folder.