NetTalk Central

Author Topic: Advice on new app, how to approach this project  (Read 1961 times)

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Advice on new app, how to approach this project
« on: March 21, 2021, 09:35:40 AM »
Hello everyone,

     I would like to create an app for some of my doctors, that allows them to use their iPhone to print PDF forms.  For example, when in the OR, they need a specific form to collect some data.  I want to have them open an app on their phone, enter the patient ID number or last name, then generate the PDF for printing via airprint.
     To generate the PDF I plan on using Quick PDF templates from Klarisoft.  A separate routine using QPDF,  would load a blank version of the PDF form, fill in some fields then save the newly generated PDF form to disk with a file name that is random or has the patient ID in it.  This new form should display to the user, where they can then choose to print. 
     I have attached an image of my first attempt of this app.  I start with a browse, where the user is to enter a ID Number (MRN) if known, or a last name.  This should produce one or two records of which the user is to select one.  From here, I need to call the QPDF code to generate the blank PDF with data prefilled.
     The first issue I have is I added a message statement to the "user clicked on row in browse" embed, to be sure I have the correct patient ID session value.  I used the following:

     Message(p_web.GSV('dem:ID_NO'))

The  message is blank.  So, I'm asking for advice...is this approach going to work?  Any suggestions on better ways to do this?

Thanks,

Jeff King

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Advice on new app, how to approach this project
« Reply #1 on: March 21, 2021, 11:18:36 AM »
Hello,

     I was able to solve the initial problem by using the GUID field in my file, with the following code in the" user clicked on row" embed:


Dem:GUID = p_web.GSV('Dem:GUID')
Set(Dem:GUID_KEY, Dem:GUID_KEY)
Access:Demo.Fetch(Dem:GUID_KEY)

p_web.SSV('ID_NO', Dem:ID_NO)
p_web.SSV('LastName', Dem:LASTN)

Message(p_web.GSV('ID_NO')&' : '&p_web.GSV('LastName'))

I probably don't need to create the session variables above, instead, the dem:ID_NO and dem:LASTN fields should do.  Now I'll create a new procedure to do the QPDF stuff and try calling it from the same embed.

Thanks,

Jeff

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Advice on new app, how to approach this project
« Reply #2 on: March 22, 2021, 05:30:34 PM »
Hello all,

     I now have the source procedure that generates the filled pdf document when a row on the browse is selected.  This is stored in the web\reports folder.
     The flow I'm after is a user logs in, enters a patient ID in the search field and has one (maybe more) records returned.  They click on the record in the browse, which runs the pdf generate procedure in the background and then creates the filled pdf in the web\reports folder.  They finally click on the Form-Mapping Form menu item to retrieve the generated pdf report.
     My first thought is to create a dynamic menu item where the URL of the pdf file to send is created under the Form menu, with an item called Mapping Form.  The item should be generated and the menu refreshed on each click of the browse.  I created a variable with the correct URL and placed the variable name in the URL field of the click tab for the menu item.  However, this does not work.  Is this possible?  To create a menu item on the fly?  If not, perhaps I'm not thinking about this correctly, so any advice would be appreciated.
 
Thanks,

Jeff King

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11182
    • View Profile
Re: Advice on new app, how to approach this project
« Reply #3 on: March 22, 2021, 11:45:00 PM »
the flow sounds a bit suspect...

>>   They click on the record in the browse, which runs the pdf generate procedure in the background and then creates the filled pdf in the web\reports folder.  They finally click on the Form-Mapping Form menu item to retrieve the generated pdf report.

How do they know when the report has been created?

I would make this a lot simpler.
a) the selection of the browse row triggers a form, not a report.
ii) the form contains a start button and a progress bar - the start button calls the report - and it can be set to "auto-start" when the form opens.
3) when the report is done the progress bar will (can) change into a link which the user can then click on. (or you could make the PDF visible to them there in the page) - again the link can be "auto-clicked" when the report is ready.

Cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Advice on new app, how to approach this project
« Reply #4 on: March 27, 2021, 06:53:48 PM »
Bruce,

     Thanks for the advice.  I created a memory form and call it from the browse.  The form has three buttons on it that call the specific PDF documents I want the user to be able to generate.  All this works great!  See the attached image App.png.  As you will see, the PDF documents are created and placed in the web\reports folder.  Each button on the form has the URL field of the template, filled with the URL to each of these pdf documents.
     One issue remains however.  When the Generate Forms memory form opens, the three PDF documents are created right away.  This is because I call routines from the "Start of Set Value" embed.  For the "Mapping Form", the routine is FillMapping, as seen in the Code.png image.  I would prefer the PDF documents only get created if the specific button is clicked.  That is, I would like a "Button Clicked" embed where I can call the FillMapping routine.  I was not able to find one.  Is there a way I can accomplish this? 
     The reason is that when I do click on the Mapping Button, the Mapping PDF document does display to the user and then is deleted since I start the PDF name with "$$$".  However, the other two PDF documents remain.  If it is not possible to detect the button click, I can always clean up the remaining PDF's with some additional code.

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11182
    • View Profile
Re: Advice on new app, how to approach this project
« Reply #5 on: March 30, 2021, 01:17:28 AM »
Hi Jeff,

I think you are using the wrong kind of button. I recommend a START button (and associated progress bar).
If you need a demonstration of this ask in the webinar this week.

cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 400
    • View Profile
    • Email
Re: Advice on new app, how to approach this project
« Reply #6 on: April 01, 2021, 02:38:35 PM »
Bruce,

     Thanks!  Using the Start button was the key...I did not even know we had all those button types!  I also set the progress bar to "auto-link" to the URL created and now have the effect I was looking for. 

Jeff