Search these areas:
Help
Support Forums
Product Info



-Introduction
-DataWeb: What's New
-Creating an Application
-The DataWeb Designer
-Application Management
-Data Tables
-Data Tables
-Views
-Templates
-Components
-Data Analysis
-Members
-Security
-Importing
-Exporting
-FTP
-JavaScript
-Object Model
-Full-Text Search
-Domain and Email Hosting
-HotBlock Modules
-Account Management
-Glossary
-New Responsive UI Module





DataWeb Help
Support Forums
Tutorial
Script Library
Knowledge Base

Home > Support

Script Library

  convert uploaded Access Hyperlink fields to links in a view
 
  chubbard posted this script:
  Access Hyperlink fields have a non-standard format of encoding an href and text in a single field.  The href is surrounded by "#" characters, and the text is whatever comes before it. 

So-- it's pretty easy to run a script once the data is in a Westside web to turn these fields back into link fields.  Take the suppliers table for example.  It gets uploaded with a  HomePage field that is exactly the contents of the hyperlink field.  an entry looks like:

Mayumi's (on the World Wide Web)#http://www.microsoft.com/accessdev/sampleapps/mayumi.htm#

Once uploaded, do the following:
1) Add two text fields to Suppliers, "HomePageText" and "HomePageHref".
2) create the following in a script file

webcall function convertHyperlink (tablename, HLinkFld, textFld, hrefFld)
    {
    var filt=HLinkFld + "!='' ";
    var rs = Resultset(tablename, HLinkFld, filt);
    var textpart;
    var hrefpart;
    var i;
    var j;
    var setFlds = Object();
    while (rs.next())
        {
        i = rs[HLinkFld].indexOf("#");
        j = rs[HLinkFld].lastindexOf("#");   
        textpart=rs[HLinkFld].substring(0,i);
        hrefpart=rs[HLinkFld].substring(i+1,j);
        if (i>0)
            setFlds[textFld]=textpart;
        else
            setFlds[textFld]=hrefpart;

        setFlds[hrefFld]=hrefpart;
        table.update(tablename, setFlds, rs.SupplierID);
        }
    return("records updated: " + rs.getCount());

    }

3) test the script and set the parameters to
tablename:  Suppliers
HLinkFld:  HomePage
textFld:  HomePageText
hrefFld:  HomePageHref

it should update 5 records

4) in the Suppliers datafolder, upload the following files from the same Office samples directory that contains the Northwind.mdb sample database:
CAJUN.HTM
CAJLOGO.GIF
FORMAGGI.HTM
FORLOGO.GIF
WHATSNEW.GIF

5) Now add the HomePageText and HomePageHref fields to Suppliers/default.view.  Delete the existing HomePage field.

6) Click on the HomePageText field and find its "Link to Page" property in the property window.  Set it to #record.HomePageHref#.  Also, set the caption to "Home Page".

7) clieck on the HomePageHref field and uncheck the Grid and Details options for "Display in these Modes"

Now the HomePageText field should present a hyperlink in grid and details mode, and there are two different fields to edit in update/insert mode.

In V2, we'll add better support for links to uploaded files such as the CAJUN.HTM file in northwind.
 
  on 2001-06-14 13:44:40, chubbard responded:
  AAA  
Affiliate | Partner | Terms of Use | Privacy Policy | Contact Us | Pricing | Bring DataWeb In-House    
DataWeb, 720 North 10th Street, A #145, Renton, Washington 98057 *425-583-5970* Fax 484-770-4706* Email Us