Search code examples
javascriptxpagesxsp

Syntax prevents computed fields to populate using @DbLookup


I have a combo Box that lists several products. Some of these products have quotes in their names signifying inches (i.e. 12" dressing Rod). Here is my issue. I have an "On Change" event that updates several computed fields using @DbLookup populating Product Cost, Unit of Measure, & Item Number. When I select any product that uses a quote to signify inches, the computed fields do not populate. What is the significance of the quote in the product name & how do I fix this? Here is the code from the Combo Box.

try {
        var vendor = getComponent("POVendor").getValue();
        var list = @DbLookup(@DbName(), "VPL", vendor, 2);
        if (@IsError(list))
            return "Select a Vendor first|";
        else
            return list;
    } catch (e) {
        return "Please select a vendor first (Error)|";
    }

Here is the code from the computed field (it's actually an edit box that is read only & the code is the default value.) that populates with the Item Cost:

var item = getComponent("Item1").getValue();

var cost = @DbLookup(@DbName(), "PL", item, 2);

return cost;

Solution

  • Since the product list was imported I needed a way to change the " to "in.". I did by using an agent & changed all of the product names containing """ & replaced them with "in.". That worked. Now I'm just going to write a script that prohibits use of the " mark for Inches.