NetTalk Central

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - DonnEdwards

Pages: [1] 2
1
Your Views and Comments / Africa Clarion WhatsApp Group
« on: October 09, 2022, 08:44:12 AM »
At CIDC2020 in Cape Town recently, we formed a WhatsApp group for Clarion developers in Africa. It isn?t a tech support group (That?s what ClarionLive, ClarionHub and NetTalk Central are for) but it is a way for Clarion developers on the continent to keep in touch, arrange get-togethers, and so on.

So far there are 30 participants, 27 from South Africa.

Feel free to join on https://chat.whatsapp.com/HSdZnjxq18OEYLeXQgC0Yx

Please introduce yourself to the group with your name and what town (and country) you are from, plus anything else you wish to share.

If the link doesn?t work, please send me a message on +2783-310-4966 and I will add you.

Best wishes
Donn Edwards

2
The Rest - Ask For Help / Google Calendar API
« on: July 27, 2022, 01:07:50 AM »
Can anyone share some code snippets or experience using the Google Calendar API? I need to retrieve appointment information from the calendars of various doctors.

Any help will be most appreciated
Donn

CPE 11.0.13630, NT12.44

3
Hi all
I am busy with an app that sends a test email every 5 minutes from 5am to 9pm from the SMTP server mail.mensclinic.co.za to POP3 server mail.petfindsa.co.za. Normally, the mail arrives in seconds, but once the SMTP server gets busy, there can be a delay, anything up to 2 hours. Some of these messages need to arrive within a few minutes because they are being sent to an email-to-sms gateway and the patient has to wait for the SMS to get a one-time pin.

When I send the message, I also write it to a table. A few minutes later, I connect to the POP3 server and start looping through the messages, as demonstrated in the "NetTalk->email->Demo" app and the "NetTalk->email->Email Receive With Dont Download Again" examples.

In the ThisEmailReceive.Done procedure I tried the following:

dtmSentDate       DATE
Code: [Select]
if dtmSentDate < today() then
      self.OptionsDelete = true
      self.DecideToDelete
end

This successfully deleted all the emails, not just the old ones. So I'm obviously not understanding something correctly. Any suggestions, code or advice would be greatly appreciated.



4
In my NTWS app I have a memory form that has two browse forms as procedures, next to one another.

When there are plenty of rows, the browse forms line up correctly with the top of each form at the same height.

But when one of the browses has only a few records, the tops of the form no longer line up, as shown in the screen shot. It's like a vertical centre alignment, instead of top alignment.

Note: these are not Child forms. They are two separate tables that I need to compare side by side to match up corresponding pairs. Do I need to start messing with CSS styles to fix this?

I think the styles are .nt-form-flex-row, .nt-form-grid-row but I don't want to mess with stuff I don't yet understand.

All suggestions welcome.


5
Web Server - Ask For Help / Field Lookup Function
« on: June 29, 2021, 06:13:40 AM »
I have a NTWS browse form (Invoices) that I want to filter by customer number. So I created a Memory form "Filter_Invoices" that has browseInvoice as a child form.

At the moment I can display the Customer number in the memory form's header, by doing the following:

Heading: 'Invoices for Customer #' & p_web.GSV('cus:CustomerId')

What I really want is
Heading: 'Invoices for ' & Lookup('CustomerName','Customer','CustomerId='p_web.GSV('cus:CustomerId'))
so that the heading is shown as "Invoices for Acme Widgets Inc" or whatever.

Visual Basic has a function called DLookup("Field","Table","Where clause") and the Where clause can be a whole big SQL statement. I'm looking for something a little more modest. Does such a function exist in Clarion/NetTalk, or will I have to write one?

All suggestions welcome.

6
Web Server - Ask For Help / Confirmation dialog ?
« on: June 17, 2021, 12:04:36 PM »
I have a browse form where the user clicks on a button to perform a specific task. I would like to be able to check whether the task is one of 2 possible conditions, and then ask the user which condition they prefer, something like the delete confirmation box.

Clearly the MESSAGE() command is not the right thing, but I haven't found any examples of a confirmation dialog that is not part of the standard form buttons. Does such a thing exist? Alternatively, how can I display an error if something goes wrong with the code called by the button?

7
Web Server - Ask For Help / NT12 apostophe in browse forms - solved
« on: June 10, 2021, 03:06:41 AM »
I noticed some bad punctuation in some of my imported data, so I ran a filter using StringTheory to remove any strange characters:

                stname.SetValue(stline.GetLine(12))                          ! STRING(200) !Section Name
                stname.replace('"','')                                       ! Remove extra quotes in data
                stname.replace('`','''')                                     ! fix bad punctuation
                stname.replace('\','/')                                      ! fix bad punctuation
                stname.KeepChars('0123456789 .,''&ABCDEFGHIJKLMNOPQRSTUVWXYZ-/:;!@#$%^&*()+?') ! Remove weird data               
                stname.replace(',',', ')                                     ! fix bad punctuation
                stname.replace('  ',' ')                                     ! fix bad punctuation
                mp:section_name        = CLIP(LEFT(stname.GetValue())) 


All the text data is in upper case. If I look at it in a Clarion ABC app, the attached image 1 shows the data as it appears in the tables.

If I display the same TPS file in a NT web server browse form, I get the second image. Wherever there is a normal apostophe (Character 39) it is displayed as &apos;, which is weird because HTML is supposed to regard this as an HTML Entity

I have to restrain myself from editing ATTORNEY'S to the correct ATTORNEYS but that's another matter :-) Also, the "Change" form doesn't show the &apos;, only the browse form.

So what is going on? How do I fix it? Is this a bug in NT 12.19 or have I broken something?

8
Web Server - Ask For Help / Extra Buttons in Browse Forms
« on: May 30, 2021, 05:54:04 AM »
I have studied the code in the Buttons (28) example, but I'm still having problems.

Please take a look at the form I want to create (attached image)

1. Mark/unMark button

I want to be able to allow users to "mark" rows. The name of the person who mars the row is stored in the "selected_session" field. The heading is just "Selected" and instead of showing the name of the user, I show "Yes" if
AL1:selected_session = p_web.GSV('UserName')
If there is a different user name then I display "No".
If there is no user name I display "-"

If the column displays "Yes" then I want the text of the adjacent button to be "unMark", and if it is "-" then the text should be "Mark". At the moment I can't get this to work. Is there an equivalent of the Visual Basic IIF function in Clarion? I can't seem to find one.

Any suggestions would be most welcome.

2. Filter Display

I can't figure out how to display the value of a filter that is applied to the browse. An example would be "Category = 'Sales'" that I have drawn in to the image, but I have no idea how to put it there. Again, any suggestions would be most welcome.

3. Filter Button

Along with the filter display I would like a "Filter" button. in this case I want the user to be able to click it to show only the "marked" records I have in item 1.
AL1:selected_session = p_web.GSV('UserName')

I would like to be able to toggle the filter off again, so that all records can be displayed.

4. Mark Button operation

The Server Code for the Mark button is as follows:

  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)
  IF len(clip(AL1:selected_session)) <= 1
      AL1:selected_session =  p_web.GSV('UserName')
  ELSIF CLIP(AL1:selected_session) =  p_web.GSV('UserName')
      AL1:selected_session = ''
  END
  UD.Debug('This is the value of AL1:selected_session ' & AL1:selected_session)


I also have enabled the option to "Refresh browse row DATA after server code runs".

Each time the code runs, it gets the value of AL1:selected_session from the actual record, but after changing it, the record itself doesn't change, only the browse display. How do I update the record as well as the browse display?

Any suggestions, RTFM topics, etc will be greatly appreciated.

9
I have searched other forum posts dealing with the "remember me" option, but not found any answers for my question. The "BasicWithLogin (3)" example doesn't have a "remember me" option, and "LoginBeforeFrame (7)" has "remember me on this computer" but it doesn't.

I have a simple Web Server app that just needs to know who is using the app. So the login test is simple:

WebHandler / Embeds / Local Objects / p_web / Authenticate PROCEDURE(String pUser,String pPassword)

IF (pUser = 'Donn' AND pPassword = 'Donn') or (pUser = 'Brian' AND pPassword = 'Brian')
    ReturnValue = true
    p_web.SetSessionValue('UserName',pUser,'@s20')
    self.SetSessionLevel(2)
END


In the Priming section of the login form I have added:
loc:Remember = p_web.GetValue('loc:Remember')

and in the ValidateUpdate embed point I have made a small change to the sample code:

      if loc:remember = 1
        p_web.SetCookie('loc__login',loc:login,today()+30)       ! note the expiry date. It's good form
!            p_web.SetCookie('loc__password',loc:password,today()+30) ! to make sure your cookies expire sometime.
            p_web.SetCookie('loc__remember',loc:remember,today()+30)
      else
        ! don't remember, so clear cookies in browser.
        p_web.DeleteCookie('loc__login')
        p_web.DeleteCookie('loc__password')
        p_web.DeleteCookie('loc__remember')
      End


So now I can see that the cookie only has a value for loc__remember and loc__login and I have dropped the password requirement.

What I can't find is any example of the server inspecting the cookie and treating the user as logged in within the 30 days specified by the cookie.

I realize I need to run some code something like:

if p_web.GetSessionLoggedIn() = 0 then
        pUser = p_web.GetValue('loc:login')
        pRemember = p_web.GetValue('loc:remember')
        if pRemember then
               if pUser = 'Donn' or pUser = 'Brian' then
                   p_web.SetSessionValue('UserName',pUser,'@s20')
                   p_web.ValidateLogin()                   ! this sets the session to "logged in"
                   p_web.SetSessionLevel(2)
              end
       end
end


But where do I put this code so that it runs before a page is displayed?

Any advice or code correction will be most welcome.

10
Web Server - Ask For Help / PDF Tools 4.1 No longer sold
« on: May 20, 2021, 10:51:21 AM »
I need to do some PDF reports in my NetTalk Server app.

One of the options is C11EE. Another is PDF Tools 4.1. They stopped selling it earlier this year.

A third option is Klarisoft wPDF Control. There was an example app in NetTalk 9. But it isn't mentioned here: https://www.capesoft.com/docs/NetTalk12/NetWebReports.htm

Is the Klarisoft product still supported in NT12? If so, which bundle should I purchase?

The answer is in the NT Application Wizard. See attachment. If anyone has a PDF Tools License they wish to sell, please message me directly.

11
I have a database that I plan to use for two apps:
1. Web Server app for office administration using a web browser
2. Web Server API app to provide a link to other systems and an Android (disconnected) app to be written by a third party developer.

When I generated the web server app using the NetTalk Wizard I didn't click the "Server API's to sync Disconnected Data" option, only the "Web Server App - for access via a browser" option.

So now I notice that the Web Server app (correctly) deletes a record when I ask it to, but I need it to mark it as deleted by setting the DeletedTimeStamp record to Now(), because it is sharing this data with the API server, and the other systems will need to know when a record is deleted.

a) What is the correct way to modify the Delete Record routine to set the DeletedTimeStamp record instead of actually deleting the record? Is there a flag I can set or do I need to modify some code?

b) Am I correct in assuming that I will need to filter the browse forms by adding DeletedTimeStamp = 0, or is there an option I can set to do this globally?

c) When I use the NetTalk Wizard to create the "Web Server API App" should I also select "Server API's to sync Disconnected Data" so the API App will "know" about the DeletedTimeStamp field and do a soft delete?

All advice will be gratefully received.

FWIW, all my tables have the three TimeStamp records required for Disconnected data.

12
Web Server - Ask For Help / How to make a "sticky" ban list.
« on: May 03, 2021, 06:15:44 AM »
I have added around 10 IP addresses to my NT WebServer's ban list, and was wondering whether anyone has written the code to save these addresses to a text or INI file so that they can be re-loaded when I close the server and then run it again. I guess I could add them to the Windows Firewall, but I'm not sure if that's advisable.

Alternatively, is there a better way to get rid of random IPs that try to "exploit" my server?

Or am I worrying about nothing?

13
Web Server - Ask For Help / JavaScript on an Update Form
« on: April 29, 2021, 05:23:29 AM »
I have a Visit record that contains the following fields:

patient_name
sortkey

first_name
last_name

The first two fields are read-only. I want patient_name to be the first_name followed by a space and then the last_name. I want the sortkey to be the first 3 letters of the last_name in upper case, followed by the first 3 letters of the first_name, in lower case.

I want these first two fields to be updated as soon as the user changes first_name or last_name.

I wrote a JavaScript function that calculates the field values, and I used the addEventListener() method to set up an onchange event to call my function on first_name and last_name. It works correctly on a simple HTML page, but not on my NetTalk 12 Updatevisit NetWeb form wen it is running.

<!-- Script to update Sortkey and Patient name -->
<script>
// Add onclick event to vis__sortkey and vis__patient_name
document.getElementById("vis__sortkey").addEventListener("click", fnOnChange);
document.getElementById("vis__patient_name").addEventListener("click", fnOnChange);

// Get the first 3 characters of First name and first 3 character of last name for the sort key
// Written by Donn Edwards (c) 2021 Black and White Inc
function fnOnChange() {
  var strFirst = document.getElementById("vis__first_name").getAttribute("Value");
  strFirst = strFirst.trim();
  var strLast = document.getElementById("vis__last_name").getAttribute("Value");
  strLast = strLast.trim();
  var strSort = strLast.toUpperCase() // Start the sort key with 3 upper case letters from Last Name
  strSort = strSort.substr(0, 3);
  var strName = strFirst              // Name consists of First Name and last Name
  strFirst = strFirst.substr(0, 3);
  strSort += strFirst.toLowerCase()   // Append 3 lower case letters from the First Name
  strName += ' '
  strName += strLast
  strName = strName.trim();
  document.getElementById("vis__patient_name").setAttribute("Value", strName); // Set the new patient name
  document.getElementById("vis__sortkey").setAttribute("Value", strSort);      // Set the new sort key
}
</script>


My problem is that only the onclick event on the read-only fields will fire off the function.

Is there another way to do this, with or without JavaScript? I don't want to wait until the user clicks the "Save" button before calculating these values.

Update: I finally noticed the "Client Side" tab of the field properties in the form. I have specified 'fnOnChange' for both the 'onFocus' and 'onChange' values, but neither seem to have any effect, either as 'fnOnChange()' or 'fnOnChange'. Only the onclick works.

I'm using NT 12.17

Any help will be appreciated.

14
Web Server - Ask For Help / Thread Pool vs Thread Number
« on: April 28, 2021, 01:06:07 AM »
I am puzzled by some of the diagnostic information on my NT Webserver app.

On the "Performance" page it shows a thread pool of zero. On the "Log" page it shows thread numbers of 0, 3 and 4.

Are these different concepts?

The reason I ask is that I'm getting a "Memory block free'd twice" random error on my internet-facing server app and I'm wondering if there is some default I need to fix.

15
Web Server - Ask For Help / Firewall Rules for NetTalk Server
« on: April 28, 2021, 12:56:50 AM »
I have tried to make my Windows server as secure as possible for running my NT Webserver app.

See attached Inbound and Outbound rules. How many of the Outbound rules can I disable? I am using Remote Utilities instead of RDP and a nice LONG password for the Administrator user. It is not part of any Active Directory.

The NetTalk Server rule opens TCP ports 80 and 443.

Any other advice on how to keep my Windows Server on the internet as secure as possible will be greatly appreciated. Also, are there any other considerations when hosting the server on AWS?

Pages: [1] 2