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.


Messages - RichCPT

Pages: [1]
1
Web Server - Ask For Help / Re: API manual - "Try It"-button
« on: September 03, 2021, 10:20:25 PM »
*FIXED*
Yep, same issue here. But, the response text never displays on the page (even though it can be seen in the source DOM) if I clear it before  clicking "Try It".

I fixed this in NetTalk 11.52. by modifying the function "textToTextarea" that is defined in NetWeb.js in the folder:
    [clarion root folder]\accessory\libsrc\win\NetWeb\web\scripts

In that function modify the following line:
Code: [Select]
$('#' + textarea).html(text);
To read as follows:
Code: [Select]
$('#' + textarea).val(text);
Delete the "web" subfolder of your compiled project.
Rebuild everything.
When you open the browser to your API site, press Ctrl-F5 to clear the code cache.
It should now work. 

A "textarea" element is supposed to be just plain text.  So, it is better to use ".val" instead of ".html".

-Rich F.

2
Thanks Bruce for the discussion on the NetTalk open webinar today (June 25, 2020), about this. (The discussion is towards the end of webinar).

I will see about embedding code in the Update form that will do some GET's into the related tables when the lookup field value is changed / set when returning from the lookup.  Also, I will look at using the "pre_update" event to initialize related table display values when the Update form is first opened.

3
I have a NetTalkWebForm for Table #3 with a lookup into a .TPS VIEW with two files (Table2 and Table1).  When a selection is made in the lookup, I’d like to display values from both Table2 and Table1.  So far, I can only get values from Table2 to display on the update (table3) form.  If I can get the lookup working, the next step is to get the initial display (when in Change or View record mode) working.

Any quick suggestions on how to get the "Lookup Settings / More Assignments" to copy values from grandparent (table 1) to local variables for the update (table3) form?


4
Jane, putting in an empty string on the "Comment" field, instead of leaving it blank, had eluded me, thanks for that tip.

Peter, "Generate Automatic Comments" on the "Validations" tab is the setting I had been looking for, thanks for that.

All,
I also discovered that I can un-check the "Last on Line" and "Last on Cell" boxes which then enables the
"Suppress Comment" checkbox (3rd property from the bottom of the "Field" tab) which I can then checkmark! Once that is checkmarked, I can then turn "Last on Line" checkbox on.

However,  check-marking "Last in Cell" will clear the "Suppress Comment" checkbox.

5
On my NetWebForm procedures I do not want NT generating the field comments like, "A Number", "Required", "mm/dd/yyyy".
These comments all appear in DIV's with a CSS class of "nt-form-grid-cell nt-form-grid-cell-comment".
I'd really prefer not to generate these comment DIV's at all.
How can I tell NT not to generate them?

6
Bill,
Thanks for the tips.

Nice screenshots of your app. 

Did you happen to make a demo app for sharing?

7
The look of the Creative Tim Material Dashboard Angular 2 (MD)  stuff  (https://demos.creative-tim.com/material-dashboard-angular2/#/dashboard seems pretty nice.  If my client really wants his app to look something like that, how much work would it take to put the MD CSS and Javascript into NT WebServer so I could have:

1) The left sidebar menu.
2) The edit fields (like on "User Profile / Edit Profile") start with watermarks and then have the watermark jump up into a label position as the user makes their data entry.
3) The editing form turn into vertical list when page size becomes too narrow.
4) The various shadow effects.
5) The real application that I have seen that uses MD, has more effects like tabbed interface on detail pages and dynamic sorting of displayed tables.  There are also various color schemes to choose from in MD. 

How would I even go about making NT WebServer app look like the MD example in the above link?

8
urayoan,
Thanks for the example on using a QUEUE as the return value.  That gets me going in the right direction.   Although, I'm not sure about having to open/close the data files on each and every API call, but that is a topic for another thread. 

Putting in all the queue structures could be tedious.  But if I don't mind foregoing the self-documenting aspect of the API then it looks like I can hand-code the QUEUE like you had hand-coded the VIEW.  I can copy the record structures from the Clarion generated file structures into the various QUEUE definitions and keep a copy of them in a document that I deliver to the API consumers (people building apps to access my data).  This actually gives them better documentation because the Clarion generated record structures include the "Description" for each field from the .DCT.  The self-documenting NetTalk API doesn't include these descriptions. 


9
I should have said this legacy clarion application uses TopSpeed files and switching the files to SQL is not an option at this point.
The goal of the API is to provide an outside development team a way to read data from our topspeed files via a web browser application that they are developing.  In the first version of this "outside" program, only reading of the data will be allowed. So, for all the tables I will need an api method that returns a list of records.  In a second version, some updating of a limited number of files will be allowed, so for that I will add get, add, put api methods for the updateable files.

My issue with the "compound code table" is that for a number of tables, it is used for lookups by multiple fields from within the same table.  For example, the Person table contains seven "code" fields that all have lookups into this common "compound code table".  The first couple of these fields are:
-Region
-County
-Ethnicity
-Education

I do not see how I can create a VIEW structure in clarion when I have to "JOIN" to the same table multiple times, unless I were to create Alias tables in the dictionary. This would add about 65 alias tables to the dictionary.  Instead of adding ALIAS files, is there a way to add a bunch of MEMORY tables so these lookups will be really fast?  I have the clarion in-memory database driver.  If so, do I have to populate these tables by hand or will the clarion templates that come with the MEMORY table driver work in the NetTalk server app?

P.S. I just noticed one of the return field types in the API is "Queue".  Should I look at that as a way of combining data from the source table with all the lookup fields that go with that source table?

10
How should I go about handling a compound code table when building a NetTalk API for a legacy application?  What I mean by "compound code table" is that the application has around 70 minor dropdown / lookup fields where the descriptions are loaded from a single table.  The entries are segregated by a lookup field number or "table ID" (it is a 4 character string).  In the legacy application the dropdowns were coded by using the PDDrops template.  I want to do the lookups in the API, so the client-side API user does not have to worry about performing the lookups.  When building a "read only"  NetTalk API for this legacy app, what would be the recommended way to go about performing all these lookups? 

If it is any help, I have the "In-Memory" database driver.

11
Web Server - Ask For Help / Re: Using HOLD(XXX,1) to Lock a Record
« on: September 16, 2019, 09:21:34 AM »
Maybe LOGOUT / COMMIT is preferable over LOCK and HOLD?

LOGOUT does tend to create program hangs, at least when I tried it with a dozen people creating records in topspeed files at exactly the same time.  But maybe LOCK and HOLD create hangs too?

Before issuing the LOGOUT command, I have the program delay a random amount of time.  So, if an instructor in a classroom tells the students to hit the "Create" button at the same time there is a lower chance of workstations hanging. 

I know the documentation for LOCK and HOLD talks about "deadly embrace".  That applies to LOGOUT as well, so I designed a common routine that I call to issue the LOGOUT,  I always list a particular Control file first and then I always list the Parent and Child tables in a specific order.  But, listing the files always in the same sequence and always including a common table, first, was not enough to avoid program hangs.  Hence I put in the random delay.

Using the common routine to issue the LOGOUT command allows me to display a "Retry, Cancel" window if the program is not able to get the LOGOUT successfully within a timeout period.  BTW, don't use MESSAGE as the Retry/Cancel prompt, as that blocks other parts of the program from operating.

P.S.  I forgot to mention I was using the TopSpeed driver underneath the IP Driver.  So, it is possible the hung workstations had more to do with the IP Driver driver not working very well with LOCK / HOLD and-or LOGOUT.


12
Thanks.

The reason for the timer, while perhaps contradictory to this post's subject title, is to allow the process of sending emails to run on a background window/thread within my application.  I want the user to be able to continue doing other things in my Clarion application.  Eventually, I will probably pull this code out of the main application and let it run at the server and I will want it to be a well behaved server process and not dominate the CPU usage when it sends email.

13
I need to process many records from a work file and turn them into email messages, using NetWebClient, and POST them to mailgun.com.  The number of emails (POSTS) I am talking about could be up to 2,000 at a time.

So, that I have complete control over how rapidly the POST's will occur, I have coded a Generic window with my own looping and timer settings. But I need to know:
   1. How quickly (or slowly) should I be POSTing to the mailgun server?
   2. Do I need to wait for a netTalk event before moving onto sending the next email?  Which event?
   3. Do I need to pause after sending a certain amount of emails and wait for that amount of responses to come back or timeout?
   4. Do I use the same NetWebClient object for every POST and do I call NetWebClient.start() before initializing the fields for each post?
   5. If #4 is "NO" then do I use a limited queue of NetWebClient objects, where each POST will be using an entry from the queue and that queue entry won't be re-used until a response is received or it times out?


14
Thanks Jane.
So, it turns out there is an issue when using jFiles ver 1.81 with auto formatting turned on and a VIEW is output to JSON and field-name case is set to "AsIs".  The template puts in code to format the field based on the dictionary's Display property for the field, but as you can see from the below snippet it doesn't work because of the "lower()" used at the top of the case, but not for the field names.

json.FormatValue                 procedure(String pName, String pValue, *LONG pLiteralType)
  ...
  Case lower(pName)
  of 'Date'
    pLiteralType = json:string
    Return clip(left(p_web.FormatValue(pValue,'@D2',net:ExpandIfNeeded)))
  ...


Setting the template to use "lowercase" field names helps solve that issue.

It seems to me, though, that there is a way to specify the output format of field for the NetTalk Server API's by using a custom option in the dictionary.  That's what I really want to know.

15
Is there a dictionary property that can be set on a LONG field in a TABLE, so the field will be output as a formatted date string when used in an API Service returned VIEW?

I have the "Screen Picture" set to "@D2" in the Dictionary for a LONG field in a Table.  I have an API service that returns a VIEW which includes one table with that LONG field, but it always outputs the clarion integer representation of the date value.  It seems to me I saw a NetTalk video where the "Options" tab was used in the Dictionary to add a custom "Property" which would cause output of the field in an NT API service method to be formatted as a date string.  Could someone tell me how to set that or where it is documented or if I am remember things wrong?  Thanks.

-RichCPT

Pages: [1]