Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Set Procedure problem

  1. #1

    Set Procedure problem

    OK, I've been working on a small app with a Canvas Section. This is using Javascript scripting. I am needing to call a function written in VFP. If I SET PROCEDURE TO ... in the console it works in Desktop and Web App View, so I felt home free. Now I need to make sure the SET PROCEDURE TO is called in the App. I inserted
    Code:
    Lianja.execute('set procedure to statusprocs.prg additive');
    and the call to the VFP function goes as expected in Desktop. It errors in the Web App View with an error inferring the above code is being interpreted as a constructor. I have searched this Forum and I think I could use an export.conf, but I still think I am missing something obvious and I need to understand that before I try a shortcut...Ideas?

  2. #2
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,360
    Blog Entries
    22
    When building web apps you use.

    lianja.evaluate(“yourlibrary::yourproc()”)
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  3. #3
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,360
    Blog Entries
    22
    Web apps can’t dynamically compile scripts so exclude the file extension and make sure you deploy the dbo file.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  4. #4
    I am just going to post the delegate, it is small and I must be missing something very obvious:
    Code:
    ////////////////////////////////////////////////////////////////
    // Event delegate for 'click' event
    function page2_section2_field3_click()
    {
        // insert your code here
    
    
        //Lianja.execute('set procedure to statusprocs.prg additive');
        //var m_guid = Lianja.evaluate("get_short_id(10)");  // Call a VFP script to generate a short GUID
    
    
        
        var m_guid = lianja.evaluate("statusprocs::get_short_id(10)");
    
    
        txtpartnumber.text = m_guid;
    
    
        
        //Lianja.clipBoard(m_guid)  // Load GUID into the local clipboard
    
    };
    As you can see, bare bones. The commented execute/evaluate pair work as expected, in Desktop. I have tried every variation of evaluate I can imagine. "get_short_id" is a VFP function in the statusprocs.prg, bad naming convention, maybe? These are contained in a project named "NewStatus". I do have "statusprocs.dbo" at the cloud server location.

  5. #5
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,190
    Hi James,

    In exports.conf:

    statusprocs, get_short_id

    In your code:

    var m_guid = get_short_id(10);

    Hank

    Quote Originally Posted by JamesPat View Post
    I am just going to post the delegate, it is small and I must be missing something very obvious:
    Code:
    ////////////////////////////////////////////////////////////////
    // Event delegate for 'click' event
    function page2_section2_field3_click()
    {
        // insert your code here
    
    
        //Lianja.execute('set procedure to statusprocs.prg additive');
        //var m_guid = Lianja.evaluate("get_short_id(10)");  // Call a VFP script to generate a short GUID
    
    
        
        var m_guid = lianja.evaluate("statusprocs::get_short_id(10)");
    
    
        txtpartnumber.text = m_guid;
    
    
        
        //Lianja.clipBoard(m_guid)  // Load GUID into the local clipboard
    
    };
    As you can see, bare bones. The commented execute/evaluate pair work as expected, in Desktop. I have tried every variation of evaluate I can imagine. "get_short_id" is a VFP function in the statusprocs.prg, bad naming convention, maybe? These are contained in a project named "NewStatus". I do have "statusprocs.dbo" at the cloud server location.

  6. #6
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,360
    Blog Entries
    22
    Try that in the javascript console.

    lianja.evaluate("statusprocs::get_short_id(10)");

    Make sure you deploy the statusprocs.dbo file to your server in the app directory.

    BTW guid() actually exists in javascript too but thats just an aside.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  7. #7
    I had already tried in the js console, I just assumed the lianja object could not be accessed in the console. I copy and pasted lianja.evaluate("statusprocs::get_short_id(10)"); to insure no entry errors and the console returns:
    Code:
    Uncaught exception at <anonymous script, id=4840111296>:1: ReferenceError: Can't find variable: lianja
    1	lianja.evaluate("statusprocs::get_short_id(10)");
    Okay, how about case? So I proper-cased Lianja to Lianja.evaluate("statusprocs::get_short_id(10)"); and get the following error:
    Code:
    Uncaught exception at <anonymous script, id=4840111296>:1: Error: Method 'evaluate' undefined
    1	Lianja.evaluate("statusprocs::get_short_id(10)");
    Well, I did move past Lianja...
    I know it's me, Lianja has been around too long for this to be a problem. Just lpk'd back to Win 4.0.0 and same issue so no Mac oddity.

    Yes, the .dbo is there.

    The call is to a VFP function that takes a GUID and down-converts it to an 8-16 character pseudo GUID that is rarely duplicated (thanks to Rick Strahl). I have edited it from the Windows call to the Lianja guid() (Thanks Barry), and plan to modify the function to accept a passed GUID so the server is not the only source for GUID generation. Probably could rewrite in js, but I need to find my error in this situation.

  8. #8
    Hey Hank! Good to hear from you. I did find the info about exports.conf and knew that was the way to go. I could not find any mention of where I should add the file. I assume in the app library, say under "Other Files"? I haven't tried it as I figured I couldn't get it to work in the delegate, exports.conf would probably fail also.

  9. #9
    Lianja MVP
    Join Date
    Dec 2012
    Location
    Croatia, Zagreb
    Posts
    1,135
    Hi,

    the exports.conf file which can reside in the app and/or the library directory.
    http://www.lianja.com/doc/index.php/Exports.conf

    Josip

  10. #10
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,190
    exports.conf works great. I'm using it in a deployed web app.

    Hank

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us