This topic contains 2 replies, has 0 voices, and was last updated by adamsharpe 8 years, 2 months ago.

  • Author
    Posts
  • #6984

    kingson513

    Hi all,

    I am trying to get the result from a created saved search.

    for example:

    PHP Code:

    TransactionSearchAdvanced tsa1 = new TransactionSearchAdvanced(); tsa1.savedSearchId=”57″;
    nss.search(tsa1); 

    There may have 10 columns in the saved search.

    The saved search may have columns of formula, joined to other table.

    Is there anyway to get all of the 10 columns?

    In suite script, there is a function getColumns()

    PHP Code:

    var columns = search[z].getAllColumns();
            var ItemId = search[z].getValue(columns[0]); 

    In suite talk will there be some function do similar?

    Any hints are welcome.

    Thanks in advance.

    Best Regards,

    Kingson Cheng
    This is a cached copy. Click here to see the original post.

  • #6985

    nrao

    Hi Kingson,

    Currently retrieving formula/function, expression, summary in advanced search via Suite Talk is an enhancement in progress.

    Please file a support case in order to be attached to the enhancement (no: 153990) and receive details in regards with it.

    Some workaround that can be tried is :

    – Possibly create a Custom field on the record being searched for that stores the value captured by the Formula

    – Use Suite Script to obtain the value of the Formula column field in the Saved Search instead

    Thanks

  • #6986

    adamsharpe

    This is the only way I was able to get the values of the columns in a saved search: (InternalID, TransactionDate, SerialNumbers)

    var service = Service.Context();

    var serialNumbers = “”;

    var tsa = new TransactionSearchAdvanced

    {

    savedSearchScriptId = “customsearchtest_assemblies”

    };

    service.searchPreferences = new SearchPreferences { bodyFieldsOnly = false };

    tsa.criteria = new TransactionSearch()

    {

    basic = new TransactionSearchBasic()

    {

    internalId = new SearchMultiSelectField

    {

    @operator = SearchMultiSelectFieldOperator.anyOf,

    operatorSpecified = true,

    searchValue = new[] {

    new RecordRef() {

    type = RecordType.assemblyBuild,

    typeSpecified = true,

    internalId = assemblyBuildId

    }

    }

    }

    }

    };

    // Construct custom columns to return

    var tsr = new TransactionSearchRow();

    var tsrb = new TransactionSearchRowBasic();

    var orderIdCols = new SearchColumnSelectField[1];

    var orderIdCol = new SearchColumnSelectField();

    orderIdCols[0] = orderIdCol;

    tsrb.internalId = orderIdCols;

    var tranDateCols = new SearchColumnDateField[1];

    var tranDateCol = new SearchColumnDateField();

    tranDateCols[0] = tranDateCol;

    tsrb.tranDate = tranDateCols;

    var serialNumberCols = new SearchColumnStringField[1];

    var serialNumberCol = new SearchColumnStringField();

    serialNumberCols[0] = serialNumberCol;

    tsrb.serialNumbers = serialNumberCols;

    tsr.basic = tsrb;

    tsa.columns = tsr;

    var response = service.search(tsa);

    if (response.status.isSuccess)

    {

    var searchRows = response.searchRowList;

    if (searchRows != null && searchRows.Length >= 1)

    {

    foreach (SearchRow t in searchRows)

    {

    var transactionRow = (TransactionSearchRow)t;

    if (transactionRow.basic.serialNumbers != null)

    {

    return transactionRow.basic.serialNumbers[0].searchValue;

    }

    }

    }

    }

    return serialNumbers;

You must be logged in to reply to this topic.