Results 1 to 6 of 6

Thread: [Answers] VFP migration

Threaded View

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

    [Answers] VFP migration

    For testing purposes you can select the Console Workspace and enter DO <program>, or DO FORM <.scp_file_name>.
    Unfortunately you can not visually manipulate your existing VFP forms if that's what you are trying to do.



    Drag/drop your VFP data files into Lianja and they will be converted automatically



    You only need to specify the extension if it is not the default extension. So for DO the default extension is '.prg', for DO FORM, the default extension is '.scp'. Similarly, for SET CLASSLIB, the default extension is '.vcp'.



    Q:
    Everything seemed to work on the imports, but what do I do to make it run?
    A:
    Imports of Visual FoxPro projects, classes and forms extract the data from the VFP tables and generate source code scripts in your App. Start from the Lianja/VFP Command Window in the Console Workspace and run your scripts using DO or DO FORM and issue any required SET CLASSLIB or SET PROCEDURE commands to reference libraries.
    Check the Error and Log windows in the Console Workspace for any issues. Your scripts can be edited in the Apps Workspace.
    Form scripts (*.scp) can also be referenced from a Page (Pages Workspace -> Form Tools -> Page), in which case they are embedded in a full-Page sized VFP Custom Section in your App. To modify the Custom Section, edit the Form script on which it is based, to add other Pages to the App, use any of the wide range of Lianja in-built Sections.



    Q:
    I'm imported the entire project. And now what follow?
    A:
    After importing, these are the steps:
    1. Test your forms/programs from the Lianja/VFP Command Window in the Console or in the App Inspector using DO FORM or DO and check the Error Window/Tab for any errors reported.
    2. If you want to embed your forms into Lianja Pages, select them from the Form Tools -> Page list of imported forms.
    3. Complete your App with any additional or replacement Pages.
    4. Set the Published checkbox in your App Settings.
    5. In the Deploy Worksurface, create an Installer exe for your App, Data and any Library scripts. Include the Lianja App Center (download the distribution and copy into the lianja\redist folder) if required. The 'template' installer can be used as a model for your own installer.



    When the importer reads your scx files, it will pick up the classloc for the objects and add in a
    set classlib to "name-of-classlib" additive

    at the top of the scp source files it creates (your vcx files will be imported as vcp source files).
    You can check these and reorder if necessary. Alternatively, if you start from a prg, you can put the set classlib ... additive commands in there.



    Q:
    I have an existing application written in VFP 9 and this app is using Ms SQL 2012 for data storage. This DB has a lot of stored procedures and triggers - a huge amount of business logic is written there.
    I'd like to use this database and build new user interface from scratch (Desktop, Mobile) using Lianja. To my surprise Lianja is not "using" ODBC to read/write data but it can import data and/or create virtual tables (I'm not sure what's the usage of virtual tables)
    I've played with virtual tables from ODBC and also import from ODBC but neither option seems to be good in my case. Correct me if I'm wrong but looks like Lianja is always using it's own database so I won't be able to save the data back in Ms SQL.
    If that's the case how can use Lianja for my project ? Should I convert my database to Lianja SQL ? Is it possible to transfer all the complicated code written in T-SQL (SP, triggers) into Lianja SQL or I will have to write it from scratch ?
    A:
    The 'Import from ODBC' imports the structure/data of the remote tables into a local native Lianja database, so not what you want.
    Virtual Tables are what you want - they comprise a connection to the remote data, a local 'virtual' table and a cursor adaptor object.
    Using
    Virtual Tables, you design as if you were using local native Lianja data, but you read/update the remote data source via ODBC.



    Q:
    problem when try to run a form from the console, it ask for baseform class which is a build in class in vfp so i can't import it.
    A:
    Add the definition to your form (before baseform is referenced):

    Code:
    define class baseform as form
    // ... any properties/methods you want to set
    enddefine


    Q:
    Error:
    thisform.controls(X1).LEFT=IIF(THISFORM.CONTROLS(X 1).TAG=' ',thisform.controls(X1).LEFT*M.SCRSZ,thisform.cont rols(X1).LEFT)
    A:
    Code:
    ...
    oCurrctrl = thisform.controls(X1)
    oCurrctrl.LEFT=IIF(empty(oCurrctrl.TAG),oCurrctrl.LEFT*M.SCRSZ,oCurrctrl.LEFT)
    ...


    I would recommend running your forms using DO or DO FORM from the Console Workspace first. That way if any errors are reported, you can see what's happening (and as Dave says, submit a ticket if you need us to look into it). Once you are happy with the behaviour of a form run from the Console, trying loading it as a new page from the Form Tools -> Page -> VFP Forms -> *.scp.
    The Form Tools -> Sections -> Custom -> Visual FoxPro allows you to code a Section.



    Q:
    Error: DEFINE class 'MNU1' AS 'MNU'
    A:
    Lianja does not support quotes around the class and baseclass names. Please try modifying the line to:

    Code:
    DEFINE class MNU1 AS MNU


    Q:
    Thisform. Do the VFP references still work ? thisform.GRID1.COLUMNS(A).header1.CAPTION=iif(empt(CONTROL.CAP),TRIM(field_name),trim(CONTRO L.CAP))
    A:
    Yes, if you are running a VFP form - scx imported to scp or program.
    You use Lianja.get("page.section").grid to reference standard Grid sections created from the Form Tools or drag 'n' drop.



    Q:
    how to run an application imported from VFP.

    A:
    Once you have imported the files (http://www.lianja.com/documentation/...l-FoxPro-files), first try running them from the Console Workspace using DO or DO FORM. See how these run and look out for any error messages in the Error Window. You can also use the Debugger in the App Inspector (http://www.lianja.com/resources/blog...ck-start-guide).
    Once you are happy with how they run from the Console, try the embedded Page functionality - in the Pages Workspace from the Form Tools -> Page you will find a list of your imported scx (imported as scp) files. Select these to create a Page in your App with the Form code embedded.



    Import the database in the Data Workspace in the App Builder, then use the Deploy Workspace to deploy it to the Lianja SQL Server data directory.



    The first thing you do is import the individual vcx files.
    Once they are imported they will exist in source code as vcp files.
    you then need to arrange the SET CLASSLIB commands to load the class libraries in the correct order so the compiler knows about the classes when it is parsing.



    if you are sub-classing another class it must be defined above in the file.



    Please make sure that you are in the "Apps" workspace as selected from the left side of the screen.

    Name:  Image.jpg
Views: 1309
Size:  76.3 KB



    ​All topics in [Answers] alphabetically:http://www.lianja.com/community/show...ll=1#post12352
    Last edited by josipradnik; 2016-03-09 at 04:04.

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