Variables

Javascript does not have strongly typed variables. In that it is similar to VFP.

Variables are created with the var keyword, similar to the LOCAL keyword in VFP. On creation they do not get any value initially unless assigned.

Variable scoping will be discussed after discussing anonymous functions.

Variable names in javascript are case sensitive.

var a = 100;
var A = 10;
alert(a); gives 100
alert(A); gives 10

This can be a pitfall for VFP developers are we are not used to it. If you start getting wrong results, check the capitalization of variables. Also, sometimes… Continue reading

This is the first in a series of blog I am planning to write to document my experience in the differences in development of software between VFP and JavaScript.

Topics in this series are not going to be covered indepth. Neither am I well versed in javascript. So this will just be a supplementary to your other sources

JavaScript is based on the c language and it borrows it syntax from c. It is similar to VFP with some differences.

Statements end with a ;

Multiple statments are grouped together inside {}

 

Flow Control

JavaScript has equivalent control flow… Continue reading

Calvin Hsia has a great article at http://blogs.msdn.com/b/calvin_hsia/archive/2004/12/13/282351.aspx about creating a service from a VFP executable.

After running a service, at some point of time, we will be required to update it to a new version. For this we will require the running of another update service.

Structure of Normal Service

Our service will generally be based on a timer and will have a structure like

  1. Setup environment
  2. Create timer based object
  3. Enable the timer

In timer object  in the timer event we will have

  1. This.enabled=.f.
  2. Do something
  3. This.enabled=.t.

Changes to Service

To create an updatable service, first add… Continue reading

i have updated the excel report form to automate the calculation of rows and columns.

as i am not getting a hang of the formatting of the weblog, i am enclosing a word document in the enclosed zip file.

refer to http://weblogs.foxite.com/tushar/archive/2010/07/18/12859.aspx and http://weblogs.foxite.com/tushar/archive/2010/07/06/12760.aspx for previous versions on the same topic.

i implemented christof wollenhaupt's svn solution for versioning and taking backups of my source files.
as it was setup to run on shutdown of vfp, it would take a long time to quit visual foxpro on some of my bigger projects.
so i decided to make it as a background task run off the scheduler.

i created a folder which would hold the xml output file.
in that i created subfolders in it for each of my project.
the source files would be copied into these folder.
the prgs would be copied as is, whereas the scxs, vcxs, frxs etc… Continue reading

updated the excel listener

updates

1. continuous excel sheet.
make continuous property .t. this will print the page header only once. page footers will be ignored, so you will get a continuous report

2. formula in group footers
right click on any object in group footer, or select multiple objects in group footer and right click. in the dialog box, choose total. this will then create formula in the excel worksheet instead of just the value. so the excel cell will have =sum(.....). this will only happen for calculated object in group footer and summary band. the reset at should… Continue reading

this listener follows a different approach in the sense the that developer had to make the report ready for being transferred to excel, unlike the others that take a frx directly and try to convert to excel by making intelligent guesses as to which report control belongs to which excel cell.

to do that, you run the excelreport.scx form and choose the frx file to be converted. this gives you a screen similar to the report designer.

to create columns, click on the top container where you want to column to begin

similarly to create rows in the bands, clicking… Continue reading

alternatives to public variables

use of public variable is not considered a good idea.
for reasons you can visit everybody
tells me that public variables are not good practice -
why?

i am trying to document why public variables are used by
developers and what are the safer alternatives.

for globally available variables.

create a custom class to hold the global variables as
properties. use the assign event to check if the
current procedure is allowed to update the value
code
example

making values available to forms

pass them as parameters
do form form2 with lnparameter1,lnparameter2
for each of the… Continue reading

in a client/server environment we sometimes have to bring down large data over the network, especially if we are displaying lookup tables. instead, if we could have a local copy of the same table and keep it in sync with the server table, we could decrease the network load.

server database setup

to do so, we first need to keep track of the changed records on the online database. this is done by having an update serial number for each record.

to track the deleted records, create a table called deleted with the fields tablename c(25), pk int, updatesr int.… Continue reading