Monday, November 26, 2012

Building a lookup for selecting a file


1. In the AOT, open the VendFormLetterParameters table and create a new field with
the following properties:

Property                 Value
Type                       String
Name                     TermsAndConditions
Label                      Terms & conditions
ExtendedDataType  FilenameOpen

2. Then add the field to the bottom of the table's PurchaseOrder field group.

3. Next, open the PurchFormLetterParameters form, and create the following
four methods:

public str fileNameLookupTitle()
{
    return "Select Terms & conditions document";
}

public str fileNameLookupInitialPath()
{
    container file;
    file = fileNameSplit(VendFormletterParameters.TermsAndConditions);
    return conPeek(file ,1);
}

public str fileNameLookupFilename()
{
    Filename path;
    Filename name;
    Filename type;
    [path, name, type] = fileNameSplit(VendFormletterParameters.TermsAndConditions);
    return name + type;
}

public container fileNameLookupFilter()
{
    #File
    return [WinAPI::fileType(#txt), #AllFilesName+#txt];
}

4. As a result, we should be able to select and store a text file in the Procurement and
sourcing | Setup | Forms | Form setup form in the Terms & conditions field under
the Purchase order tab of the page:



No comments: