Normal Topic Adding Pictures Directly to Records from Client (Read 818 times)
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Adding Pictures Directly to Records from Client
Aug 5th, 2016 at 2:15pm
Print Post Print Post  
Hello, I was wondering if it was possible to add an attachment button with programming, that would allow one to add photos directly to a record, without having to go through Sesame Designer, and without having to manually move them into the "Pics" folder?

I think as long as I know that it's capable/possible to do this, then I'll go forward with trying to figure it out.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: Adding Pictures Directly to Records from Client
Reply #1 - Aug 16th, 2016 at 10:27pm
Print Post Print Post  
actiontech,

If I understand correctly you want to have a user be able to attach a document or picture to a clients record. It can certainly be done and I bet there are many ways.

My method (that may be outdated due to newer more powerful sesame commands) works great and was made possible with the help of Hammer Data systems.

Basically I have a directory on each users machine called Attach. I have the user drop whatever file they want to attach in that directory prior to clicking the attach command button. The attach command button when pressed asks my user with  @PopupChoiceList what type of document they are attaching so Sesame knows where to put it on our "shared documents" drive. It then renames the file in attached to the correct syntax I have chosen (my patient ID etc..) and moves it to the permanent directory for my client. The system then updates a radio button color to green to show that there is an available document.

If you are just going to display the picture you want it will be much simpler you will just need to have the image match the correct name on your picture element. so you will not need to ask the user anything and all you will need to do is name the file correctly and move the file to where sesame will be looking for it.

(look at the rename and move part of the code)

My code may be a bit convoluted / confusing for you because my command button looks for different types of documents and checks to see if a document already exists and if it does it adds/merges the new documents with the old so it may be more confusing than helpful. But maybe it will give you a direction.

This is the command button part:

var vResult1 as string
var vChoices as string
var vDocTypes as string
var vDirs as string
var vDocType as string
var vDir as string
var vPos as int

     vDocType = ""

     vChoices = "Script;" +
     "Medical Documentation;" +
     "HST Insurance Docs;" +
     "Hst Recieved Doc;" +
     "HST Sent Back Doc;" +
     "HST Questionnaire;" +
     "HST Study;" +
     "HST Study 2;" +
     "HST Study 3;" +
     "Interp 1;" +
     "Interp 2;" +
     "Interp 3;" +
     "Signed Super Bill 1;" +
     "Signed Super Bill 2;" +
     "DDS Docs;" +
     "HRV Data Sheet"

     vDocTypes = "script;" +
     "MedDoc;" +
     "InsDoc;" +
     "HSTRec;" +
     "HSTSback;" +
     "HSTDoc;" +
     "HSTStudy;" +
     "HSTStudy2;" +
     "HSTStudy3;" +
     "Interp;" +
     "Interp2;" +
     "Interp3;" +
     "sb1;" +
     "sb2;" +
     "DDSBDOCS;" +
     "HRVDS"

     vDirs = "sesame\script\done\;" +
     "MedDoc\;" +
     "InsDoc\;" +
     "HSTRec\;" +
     "HSTSback\;" +
     "HSTDOC\;" +
     "HSTStudy\;" +
     "HSTStudy2\;" +
     "HSTStudy3\;" +
     "Interp\;" +
     "Interp2\;" +
     "Interp3\;" +
     "sb1\;" +
     "SB2\;" +
     "DDSB\;" +
     "HRVDsheet"      


     PopupSelectPosition(4, @XPos(status), @YPos(status))
     vResult1 = @PopupChoiceList(vChoices, "Select A Document Type to upload")

     if(vResult1 = "")
     {
           @MsgBox("", "No Document type Selected", "")
     }
     else
     {
           vPos = @FindStringArray(vChoices, vResult1)
           if(vPos > -1)
           {
                 vDocType = @AccessStringArray(vDocTypes, vPos)
                 vDir = @AccessStringArray(vDirs, vPos)
                 hdsMergeAndAttach(vDocType, vDir)
           }
           else
           {
                 @MsgBox("", "Invalid Document type Selected", "")
           }

     }

This is the subroutine it calls from global code:

subroutine hdsMergeAndAttach(aDocType as string, aDir as string)
var Vresult as string
var m as int
var n as int
var s as int
var D as int
var Vrname as string
var vDirNfile as string

     LocalCWD("c:\Attach")
     vresult = @LocalFileDialog("choose a Document to work with", "*.pdf")
     if(Vresult = "")
     {
           @MsgBox("", "You Have not selected any Document to process", "")
     }
     else
     {
           // Sets the name to use during renaming, moving and displaying pdf
           vrname = (ptid + aDocType + ".pdf")

           vDirNfile = (@ClientLocalValue("pathVariable") + aDir + vrname)

           // check to see if a file is already
           if(FileExists(vDirNfile)) // needs to be changed based on working directory
           {
                 // merge vrname and vresult and output to vdir as vr name
                 m = @Shell("c:\sesame\merge.exe -qm " + vresult + " " + vDirNfile  + " -o " + vDirNfile)
                 D = @Shell("Move C:\Attach\*.pdf c:\store")
           }
           else
           {
                 // Renames pdf from original to new name of patient ID plus word script
                 n = @Shell( "ren " + @Chr(34) + vresult + @Chr(34) + " " + @Chr(34) + vrname + @Chr(34) )

                 // moves from script directory to done
                 m = @Shell( "move " + @Chr(34) + "c:\Attach\" + vrname + @Chr(34) + " " + @Chr(34) + @ClientLocalValue("myscriptpath") + aDir + @Chr(34) )
                 ynUpdate()
           }
     }
     LocalCWD("C:\sesame\")
end subroutine

I hope I did not confuse you more than help you. If you still need some direction let us know.

Keep us posted on your progress!
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
actiontech
Full Member
***
Offline



Posts: 173
Joined: Apr 10th, 2016
Re: Adding Pictures Directly to Records from Client
Reply #2 - Aug 26th, 2016 at 4:49pm
Print Post Print Post  
That's awesome thank you very much. I will definitely look at this code, and try it out and see what it works like, I'm always eager to learn more.

I wasn't able to get back to the forum in time to see it, I think I lost my password or something and had to reset. But I ended up using the "image box" layout element. Pretty simple really, you just double click on it, and then you can attach pictures from a directory from a tree, and there's a preview pane. I had to change the applications root directory for pictures but it wasn't much of a problem. The pictures are different sizes (e.g. smartphone, verticals and wides) so they don't always fit the 100x100 thumbnail "image box" I created. But it seems to work fairly ok.

Right now I'm experimenting with @staticdrawimage or something like that to see if I can create a button, that when clicked will create a preview of the image selected (checkbox bound to element) in the middle of the Sesame screen.

I'm also working on a feature where, I can check my checkboxes for different images, and enter some e-mail criteria, like an e-mail address and subject line, and just click a button to "send" using Sesame's e-mail API, I think that's right? Not sure if that's an API.

Basic philosophy, the more I can get Sesame to do directly, the easier the work is, and the cooler. Heck, if I could take a word processor out of the equation that would be great too.
  
Back to top
 
IP Logged