Little Pieces of Knowledge Set Web Components to automatically be displayed



Download 57.15 Kb.
Date13.05.2017
Size57.15 Kb.
#17914
Alpha Five v11 Tips & Techniques

March, 2012


Little Pieces of Knowledge
Set Web Components to automatically be displayed

Make Control Panel the active window – File – Database Properties

Set checkbox to automatically open web projects control panel

Create Folder in Webroot for project

Profiles - Folder in Web root – Target folder



Set Vertical size of Help Text Box

In the Grid properties, help for any selected property is shown at the bottom of the listing. If it contains more lines than can be viewed, drag and move up the top border line to expand the size.



Set automatic backups

This is easy to do and once setup, you can set that the system will prompt you for a backup every x days. You can also initiate a “one click” backup easily.

??? more ???


Include in grid but hide column

Check the box on Hide column



Searching for Information
Find your posts

Advanced search – enter your logon name – lists only threads you started


Quicklinks – subscribed threads – lists all threads you started AND threads you have replied to AS LONG AS you accepted the default “Subscribe to this thread” option.

Search ONLY Web related posts

Advanced search – Search Single Content Search

Search type: POSTS

Click on “Additional options”

Search in forums – select the name for all web related subforums and click on search subforums

Click GO on “save search preferences”



Training & Tutorials
Bob Moore’s Video Tutorials

http://tutorials.micromediastudios.com/


Alphadevnet video Training

http://alphadevnet.com/video.a5w


Youtube videos

http://www.youtube.com/user/AlphaSoftwareInc?ob=0&feature=results_main

Best Resources to Learn Javascript – videos and book

http://stackoverflow.com/questions/11246/best-resources-to-learn-javascript

Scroll down to “The JavaScript Programming Language” for the 4 videos



Using Xbasic with SQL Tables

http://www.downloads.alphasoftware.com/Tutorials/UsingXbasicWithSQLTables.html

Series of 14 videos explaining why using AlphaDAO directly to SQL databases is far superior to that of using Active Link tables. Has text covering much of the subject.




Learning Xbasic

http://wiki.alphasoftware.com/Contents+-+Learning+Xbasic


Introduction to Ajax Callbacks

http://msgboard.alphasoftware.com/alphaforum/showthread.php?98606-Intro-to-EASY-user-defined-Ajax-callbacks-key-for-Access-developer-learning-Alpha-5
http://wiki.alphasoftware.com/User+Defined+Ajax+Callbacks+in+Grids+V10#comments&highlight=ajax%20callback%20introduction
Debugging
Javascript Debugging in Firefox w/ Firebug (search list of videos)

http://tutorials.micromediastudios.com/


Use of Xbasic Debug(1) and Working Preview

Put Debug(1) in Xbasic function

Only works in working Preview

In grid below, if e is defined as parameter, enter e and press enter.

Click on the “+” in front of the “e” to drill down and see available data.


Run live tests using Firefox with Firebug turned on

Put Debug(1) in Xbasic function



turn on Firebug (for me that is the upper right of my Firebox window)
Click NET

Select "ALL in the Firebug window
Click on Clear
Submit the data on your web page

Click on the "+" on the very last POST
The click on the POST tab and I can see all the data sent to the server
(A little different than Steve Workings video but very similar)


Display Grid Processing time for Various Activities

This is taken from this posting on a LInkedIn group

http://www.linkedin.com/groups/Annou...%2Egmr_3799453

First, we turned on a flag in the Grid to show timing information.In the Server side events, onGridExecute() event, we added this line 

e.tmpl.timer = .t. 

With this flag turned on, the Grid displays timing information for how long various parts of the Grid execution are taking.

Adobe Shadow for debugging portable devices

http://msgboard.alphasoftware.com/alphaforum/showthread.php?99367-I-ve-been-doing-quite-a-bit-of-Mobile-work-you-may-find-this-lnk-helpful-as-I-have


Technique
Set Grid Field Default Value to Page Variable

Useful when using a pagevariable to provide the filter for current data and adding records related to the current record

Initial Value: PageVariable.

Note that you use this syntax even for a numeric grid field

This does not work for a grid inside a tabbed UI.

This is not a bug.  A PageVariable is only available in the first "page" opened and not passed to any component opened from it..  However, any value passed in the URL is also normally available as a request variable and that should be available to any component.

 

Therefore you can add this to the server side event OnInitialvalueCalculate, assuming the URL has "page.a5w?id=somenumber"



 

if variable_exists("e.rv.id")

    e.newvalues.CaseNum = e.rv.id

end if


 

This has the same effect as putting it in the field properties

 

Jerry Brightbill


jerry@alphasoftware.com

Link to a new page selecting the key of the current row – Preferred option
Set the link properties as shown below. Setting the link as below, targeting “Browser window” and “_self” will cause the new page to replace the current page.


In the target page, you must also set the parameters. Edit the page layout within the A5w page for each included component to specify a base filter.


Then at the bottom of the calling page definition, you must set the necessary parameters equal to whatever field on the current record is appropriate:


Link to a new page selecting the key of the current row – Option 2

This and the next item are one way to do this. Another way is to do an Ajax callback to set session variables then return javascript code to open the new page. Neither are the preferred ways. The preferred way is to create a link, like on this but then to set arguments in the target page and set the argument values in this call.

You must do this AND follow the next point to define the filter for the grids which will subsequently be displayed.

For the key value of the grid row, define the Control type as Link

Set link properties





Click the … in link address and use the builder




Works slick!
Link to a new page selecting the key of the current row – Option 3

Neither this nor Option 2 above are the preferred ways. The preferred way is to create a link, using A5 built in capabilities but then to set arguments in the target page and set the argument values in this call. See above Option 2.
This method involves using an Ajax callback to an Xbasic routine to set page variables and then return a javascript comment in the return string that causes the new page to load. It is not preferred due to the time delay of the ajax callback given that there is another way to do the same thing.
function Set_Session_Variables as c (e as p)
    debug(1)
    session.lastname = e._currentRowDatanew.lastname
    session.firstname = e._currentRowDatanew.firstname

    Set_Session_Variables = "window.location = 'CLientDetailTabbedPage.a5w';"




Use a page variable to filter grid components

In grid define an argument equal to the page variable and then set the filter

Ex Argument named selclient


Filter: casenum = :selclient


Add a calculated field to a grid

Can’t add an unbound field as you can in Access

Instead add to the Query(AlphaDAO) definition:

Ex. SELECT *, yearsbetweendates(DOB, currentdate() ) AS Age

FROM tbl_Client_Data
Note to identify what functions are available in the SQL, select

Edit SQL in query builder

Select columns

Select edit in the upper right



To obtain other data from data in record of drop down list box (like you can in Access)

In A5 only one field can be returned.

However, select the OnChange event

Add new Action

Set Page Content

Set table name and linking field from current grid to table

Click on fill in fields. Relate the grid field to the table field.

Cross Field validation

Instead of using the server side events caninsertrecord and canupdaterecord, similar to how you would do it in Access, instead choose one of the involved fields and specify Validation Xbasic

The default is to run on server side which ensures that all fields should have been entered.

The sample code in the Xbasic window should given you the syntax you need. See video 6.



List box which allows the user to enter text not in the list box.

Cannot do this with a list box, due to HTML limitations.

Instead, select a text box and check Lookup

Select Lookuptype=Edit Combo List

Click on lookup definition


Do NOT check “User must select from list”. Any user entered data is NOT added to the list.


To highlight fields/controls which are blank, to remind users they are required fields.

Click button to edit Conditional style

Create a condition


Click on the background color icon and select a color. The effect is shown.

Conditional style level = control

Note: For date fields, you must select the cell rather than the control.
Laying out fields on the same line

By convention, fields in grids are laid out on a single row, left to right

To utilize more than 1 row, add a break after any field, to start the next field on the following row.

The break is the equivalent of CR and LF.


In detail areas, data is displayed Left to right, top to bottom.

If you specify one column for the data, it will all be in one column.

If you want to format adjacent fields, like city, state and zip, you can utilize the Free Form Layout.

With it you can insert fields and labels.


For better control of the spacing, be sure to select the HTML Editor and use it.

Apparently you can insert a table and use that for more control over positioning.



Define session variable in a5w page

<%a5

Dim session.{my_Session_Variable} as C = “”

Dim session.{my_Session_Variable} as I = 0

%>

Multiple Columns in a Grid Detail View

Create a container for the contents of the first column and another for the contents of the second column.

Specify “Number of Layout Columns” = 1 even though you are going to have multiple cols

Remove the break from the end of the first column.

Format session variable displayed in header HTML
Staff Member:

<%a5

?session.teacher_name

%>

Tell if date is empty/null/not initialized

My workaround was to create a new field in the query with syntax

Isnull() as DateInd
http://msgboard.alphasoftware.com/alphaforum/showthread.php?98898-isdate(date_field)-in-show-hide-expression

blank date is 2455991 days behind today's date

{mydate} >{01/01/0001} Is true then {mydate} is valid date


A5 button on grid to set session variables and link to new page

Do NOT try to set two Active scripting events, one to do a callback to xbasic to set the session variable and a second to link to a new page. Because callbacks are async, as soon as the callback is sent to the host, the second event will fire and open the new page before the xbasic is finished.

Instead, make one xbasic callback, set the session variables and include the javascript to open the new page in the response variable.
function Set_Session_Variables as c (e as p)
    debug(1)
    session.lastname = e._currentRowDatanew.lastname
    session.firstname = e._currentRowDatanew.firstname

    Set_Session_Variables = "window.location = 'CLientDetailTabbedPage.a5w';"


Note that you will need to have the grid be editable in order for the e data to be available. There is an option - "Compute current row data" at the bottom of the Ajax Callback setup screen. A5 will "query the database to retrieve the field values for the current row". I just tested this in my app and it works.




Hidden button technique for doing Xbasic callback before onclick event of hidden button
See post: http://msgboard.alphasoftware.com/alphaforum/showthread.php?99008-Timing-arrrrrggggg&p=602296&viewfull=1#post602296
Thanks to Carol King:
Another thing I do quite often is create a 'hidden' button to open a page (or grid in window). Hide it by putting 1=2 into Show/Hide Expression of the button. MUST NOT check the Hide box of the button or the call to its OnClick from Xbasic function will not work. Then the first unhidden button does ajax callback to an Xbasic function to set session variables and returns a call to the OnClick event of the second hidden button.

EXAMPLES OF CALLING ONCLICK EVENT OF A BUTTON FROM XBASIC FUNCTION (will need to substitute appropriate BUTTON_? number):

If on a dialog component:
FunctionName = "$('{dialog.componentname}.V.R1.BUTTON_1').click()"

If on a grid (not detail view): (this syntax recommended by Selwyn)
FunctionName = "var ele = $('"+e.tmpl.componentname +".V.R{grid.rowNumber}._UNBOUND_BUTTON_5');ele.click();"

If on a detail view:
FunctionName = "var ele = $('" + e.tmpl.componentName + ".D.V.R1._UNBOUND_BUTTON_3');ele.click();"


Dynamically set field labels at run time
Bob Moore posted about a great method of allowing you to have user control at run time of field labels but defining the label as a DIV (

http://msgboard.alphasoftware.com/alphaforum/showthread.php?82385-Grid-Detail-Column-Heading-JS-syntax&p=525304&viewfull=1#post525304
and
http://msgboard.alphasoftware.com/alphaforum/showthread.php?82385-Grid-Detail-Column-Heading-JS-syntax&p=525392&viewfull=1#post525392
Here is a direct link to the video: http://www.screencast.com/t/YmMxMzFkNzA

I found that for me, using v11, it only worked in the onclick of a button or in onGridRender and NOT in onDetailViewRender. But it works slick!

Note this is quite case sensitive!!!


How to send Session variables to a Javascript global variable

Bob Moore again. http://screencast.com/t/NGU2MzM4N2Et
This is the essence of the technique. Note that this is all done at grid render time.

Line 3 creates a session variable.

Line 5 sets a client global variable named :awesome” to the value in the session variable.

Line 6 shows an alert that demonstrates that the client side global variable does exist.


Additional techniques are discussed in the message thread

http://msgboard.alphasoftware.com/alphaforum/showthread.php?83740-Passing-session-variable-to-JavaScript&highlight=session+variable+global+variable
Note this is quite case sensitive!!!

How to encrypt/obscure page variables included in URL

When using page variables, which appear on the url after the “?” there is the potential that the system user could alter the value to access data they are not entitled to see. Steve Wood replied to my post



http://msgboard.alphasoftware.com/alphaforum/showthread.php?99039-Any-built-in-capability-to-encrypt-obscure-page-variable-in-redirect-URL

about how to deal with this. Essentially, he said:

I often add a second unique ID to tables where I know I will need to link or use the "ID" in public. So my vendor_id might be 1,2,3, etc. But the "EID" (E for external) will be a 32 character GUID created when the record was inserted with remspecial(api_uuidcreate()).

Then my link above might be mypage.a5w?i=c19fe68a92234952a087ddf4341281a9”



Align checkbox in the cell/field

Use Freeform template. Click HTML editor. Insert table - specify 1 row and 2 columns - width 10 – border size = 0

Insert field name surrounded with {.....} in 2nd column

Click on Source. Copy and past multiple &npsp; fields - 3 or 4 (you can fine tune this later)
Xbasic for Access VBA Programmers
Be sure to enclose logical operators with “.” Characters: .and. .or. .not.
Resultsets are Read Only. To update data, you must use SQL statements.
Enclose literals in single quote marks
Activelink tables are inefficient for web apps. Use AlphaDAO data source definitions instead.
Every AlphaDAO command returns a T/F.

Prompting for Report Parameters at Run Time

The TabbedUI control has a nice capability to define parameters as “resolve at run time”. It then displays nice fields to enter the data. For dates, a calendar option is provided.




Audit trail of changes to any table

http://project-redcap.org/

Take a look at "Xbasic for Everyone" by Dr. Peter Wayne. Chapter 42. An Audit Trail. This is where I got a majority of the code. From there I tweaked bits and pieces. “




Changing TabbedUI tab text based on existence of data in the tab object

http://msgboard.alphasoftware.com/alphaforum/showthread.php?99099-Dynamic-tabbed-ui-text


Changing Contents of TabbedUI causes navigation component in the auto generated web page to be removed

When you create a tabbedUI, a web page is automatically created. If you update the tabbed UI, the web page is recreated. Wh” Don’t know.

A work around is to create a new page with the navigation component on it. Then include the tabbed UI page that was automatically created:

<%a5

A5w_include(“name_of_the_tabbbedUI-web_page”)

%>

This will create an xbasic code block with the middle line of code in it.




Table Alias for not valid

The table alias value is stored for each field name in a grid structure. If you change the data source, you will have to go to each field and change the table alias in the update sessings property section.



The “e” Data Structure and Other Parameters in Xbasic Function Templates

Some, but not all of the Alpha Five Xbasic exits have available the “e” data structure. It is not clear to me if all reported “e” data structures are available in all Xbasic exists where “e” is defined. The following data structures appear to be generally available.


Note that “e” and other parameters provided by a5 in functions are often objects that have multiple components that are directly addressable.
The best way to figure out what is there is to use the Working Preview and set “Debug(1) in your code. In grid below, if e is defined as parameter, enter e and press enter. Click on the “+” in front of the “e” to drill down and see available data.
Sometimes other variables are defined (see the function statement and its parms). For any of those, you can do the same thing to see what is available within those structures.
Also be sure to read the examples in the sample functions. Often they include examples using the data defined in your grid. I have found the examples to be EXTREMELY useful.

If you have any comments, corrections or additions, please contact the author at



Bobalston9 AT yahoo D O T com
Download 57.15 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2022
send message

    Main page