NetTalk Central

Recent Posts

Pages: 1 ... 8 9 [10]
91
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by rjolda on February 06, 2024, 10:55:48 AM »
Jeff,
GREAT!  Let us know if you want us to try and break it.
Ron :)
92
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by jking on February 06, 2024, 09:24:03 AM »
Hi Ron and Bruce,

     Your suggestions have pointed me in the right direction.  I believe I have a solution.  I'm refining code and will report back when I think it is ready.

Thanks,

Jeff
93
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by rjolda on February 06, 2024, 08:53:47 AM »
HI Jeff,
I have found that looking at code in Embeditor Source is the best way to look at what is going on.  Also, at times I have gone to the NetTalk source clw files to chase down what it is doing....
I would think that there would be an api "action" setting - e.g. = Insert, Read (get), Delete.  I might attempt to Hijack a "READ" type API and manually do my checks and inserting and return a value.
In my thinking, I would not worry about sending and error message to an Institution which is NOT IN MY TABLES.  I would send a verification message about a "Valid Insert"
Ron
94
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by jking on February 06, 2024, 08:02:17 AM »
Hi Ron,

     I have tried a number of the embeds but still don't know exactly how to "jump out" before the Insert.  It is true, I'm using the "built in" action of Insert.  This particular API will only do Inserts but I want to conditionally do the Insert based on the presence of a valid Institution ID in a lookup of our list of institutions.
     I may be wrong but I thought using the p_web.AddServiceError to set an error message was a way to jump out of doing the Insert, but this has not worked for me. 

Stay Tuned!

Jeff
95
Web Server - Ask For Help / Re: NT browse CELL Border
« Last post by rjolda on February 06, 2024, 05:32:17 AM »
Solved!
I unchecked the "Apply to Whole Cell"  on teh CSS for the column
and CHECKED the "APPLY to CONTENTS"
Now I get my border around the cell!
Ron
96
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by rjolda on February 06, 2024, 03:28:11 AM »
HI Jeff,
I can't see all of your code.  However, it sounds like you are using 'built in'  action models.  i.e. You are calling for a record insert so that the system does attempt to do that.  You then test the condition later down the tree and if the patient is there - fine.  If not, you have an orphan record hanging around - sounds like that.

I have not played with the API yet _ but I am going to be getting very friendly with it later this week as it is on my schedule!  I would maybe HIJACK the code BEFORE the system does the requested INSERT ( Bruce usually leaves embeds around these things) and run your code first.  If no instituion then then you jump out BEFORE the actual insert and return them a message that it could not be completed.

My second thought is if the system has already primed I would consider something like:
IF SELF.Request = InsertRecord AND SELF.Response = RequestCancelled
   Access:MyFile.CancelAutoInc
END
This would "Undo" the Primed Inserted record.
Ron
97
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by jking on February 05, 2024, 06:41:21 PM »
Hi Bruce,

     I'm confused by what you mean by client side auto-numbering.  This is an API that a "client" custom app will access.  This API has been added to an existing NT 14.13 server app we have had running for a few years.  The NT app does auto-numbering on a single field, the Patient_ID, on Inserts.  So I guess this would be server-side auto-numbering.

     However, based on Ron's recent post (Thanks Ron!), I changed my code.  I now have the following in the InsertRecordBeforeAdd embed of the InsertRecord:PatientEnrollment routine (NetWebServiceMethod):

    Ins:Institution_ID = Enr:Institution_ID
    If Access:Institution.Fetch(Ins:InstID_key) = Level:Benign
        Access:PatientEnrollment.PrimeAutoInc()
        Enr:Study_ID = 'Z'&Enr:Institution_ID&'-'&Enr:Patient_ID
    ELSE
        PatientEnrollment_Action = 'null'
        p_web.AddServiceError(999, '', '', 'Inst ID Not found', '')
    END

The use of the PrimeAutoInc() seems to have solved my auto-numbering issue.  I no longer have any code in the ServiceMethod routine embed.

     As you can see, I'm using the AddServiceError() in the ELSE statement above, as you hinted at in the previous post.  This does indeed send an error message as a result, when the passed Institution_ID is not valid.  However, a record is still created in the target tps file, PatientEnrollment.  This is the last issue I'm trying to solve.  A record should not be created in PatientEnrollment if there is not a valid Institution_ID in the Institution tps file.

     I thought I might be able to programmatically set the PatientEnrollment_Action variable, as seen in my code above.  So far this has not worked. 

Thanks,

Jeff
98
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by Bruce on February 05, 2024, 05:31:31 PM »
ahh, the joys of auto-numbering. Boy am I glad I've left that behind. It's 'orrible.

I presume we're talking about client-side auto-numbering here?

Cheers
Bruce
99
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by rjolda on February 05, 2024, 04:30:51 PM »
Jeff,
Something doesn't seem quite right here - something seems missing. You should be able to have your study record inserted and be able to get the values BEFORE returning a result.
When I am manually adding to a table I use the following code:
If Access:File.PrimeAutoInc() = Level:Benign
 Do stuff.
  !  needs an INSERT() to save the record here
.
The Primed fields (autonumbered) are available in the "Do stuff." section of the code BEFORE the Insert is called.
Not sure of exactly what you are trying to do but this might help you get in the right direction.
Ron
100
Web Server - Ask For Help / Re: Help with NT 14.13 API
« Last post by jking on February 05, 2024, 12:23:29 PM »
Hi Bruce,

     I've been on that "fishing trip" you recommended.  The following code is what I have come up with.  It is in the ServiceMethod Routine embed:


 Ins:Institution_ID = Enr:Institution_ID
 If Access:Institution.Fetch(Ins:InstID_key) = Level:Benign
    Set(Enr:PatID_key, Enr:PatID_key)
    Access:PatientEnrollment.Fetch(Enr:PatID_key)
    Enr:Study_ID = 'Z'&Enr:Institution_ID&'-'&Enr:Patient_ID
    Access:PatientEnrollment.Update()
 ELSE
    Access:PatientEnrollment.DeleteRecord(0)
    p_web.AddServiceError(999, '', '', 'Inst ID Not found', '')
 END


     To explain, the main goal is to use the API to do an insert on the PatientEnrollment table, and generate the Enr:Study_ID, which is passed back to the client. 

     The main problem here is the Enr:Patient_ID has an autoincrement key.  It seems the new autoincremented value of the Enr:Patient_ID is not available quickly enough during an insert, so it can be used in the construction of the Enr:Study_ID field. 

     For example, I set the passed in Enr:Institution_ID to 66, which is a valid ID in my test data, and the last Enr:Patient_ID is 1234.  After a successful Insert, I would expect the Enr:Study_ID to be:   Z66-1235.  However I get Z66-0.  Note that the insert seems to have autoincremented the Patient_ID properly as the correct value of 1235 is found in the PatientEnrollment table.

     So, my solution was to allow this partial record...that is a partial Study_ID...to be inserted and then I immediately open this record and update it with the properly constructed Study_ID.

     The other problem I found is,  when I pass an invalid Institution_ID, the API does return the proper error message I set in the above code.  However, the API still inserts a PatientEnrollment table record for this invalid Institution_ID.  I have not been able to conditionally prevent the insert, so again I delete the invalid record after the insert.

     To summarize, I'm still looking for a solution to get the next auto-incremented value of Patient_ID sooner.  Also, looking for a way to conditionally prevent the insert when the passed institution_ID is invalid.  My current solution of updating and deleting does give me the final results I'm looking for but it does seem a bit messy.

Thanks,

Jeff
Pages: 1 ... 8 9 [10]