Announcement

Collapse
No announcement yet.

Generate a single record form blocks on a wrong connection.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Generate a single record form blocks on a wrong connection.

    Hi,

    I face these two bugs:

    1. A specific connection does function properly in a grid, but in a single record form the connection for lookup is not being read.
    Generate throws an error. See attachment.
    The problem occurs in case the specific connection of the lookup differs from the default connection of the form/application.

    2. The FROM part does function in case ‘databasename.tablename’ is used: the LastName of the exhibitor is shown at the right.
    Anyhow, generate code must block on a database name in the SQL statement. It is beyond SQL standards.
    I would report this as an essential failure. The connection is leading.

    Notes:
    1. In production the databases have other names, so the specific connections are crucial.
    2. No connection specified for the SQL statement won't be a problem until more connections are in use.
    3. I remove the ORDER BY part from the generated statement, because of an unique value.

    Regards

    Jan Willem
    Attached Files
    Last edited by JWST; 06-03-2014, 01:31 PM.

  • #2
    The failure is analized

    Dear programmer,

    For statements in OnApplicationInit the PHP code is generated.
    This makes analysis easy.

    In the part of PHP 'Db' is mentioned.
    This is wrong.
    See attachments.

    Note: The name of the connection is properly generated for the simular statement in a grid.


    Regards

    Jan Willem
    Attached Files

    Comment


    • #3
      Hello,

      Sc_lookup() doesn't work on the onApplicationInit() event on a Grid application. Perhaps you should try OnScriptInit().

      http//www.scriptcase.net/docs/en_us/scriptcase-macros/scriptcase-macros#sc_lookup

      regards,
      Bernhard Bernsmann

      Comment


      • #4
        New analysis of connection problem.

        Hello Bernhard,

        You are right. The previous reproduction is not allowed. This is new analysis:
        -------------------------------------------------------------------------
        A lookup of the exhibitors lastname from the list of Dogs is no problem.
        (The connection does exist in the lookup details.)

        This is because the connection (of the single record form application)
        is equal to the connection of the Exhibitors table.

        I think the statement below, taken from the list of Dogs, needs improvement:
        $this->Db->Execute($nm_comando)
        The name of the connection is needed instead of 'Db'.

        1507| function lookup_exhibitorportal(&$conteudo)
        1508| {
        1509| global $exhibitorportal;
        1510| $this->nm_tira_formatacao();
        1511| $this->formatado = false;
        1512| $Salva_opc = $this->nmgp_opcao;
        1513| $this->nmgp_opcao = "lookup_rpc";
        1514| $this->nm_converte_datas();
        1515| $this->nmgp_opcao = $Salva_opc;
        1516| $nm_comando = "SELECT LastName
        1517| FROM ExhibitorsPortal
        1518| WHERE ExhibitorPortalId = $this->exhibitorportal";
        1519| if ($this->exhibitorportal == "")
        1520| {
        1521| $conteudo = "";
        1522| $this->nm_formatar_campos();
        1523| return;
        1524| }
        1525| $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando;
        1526| $_SESSION['scriptcase']['sc_sql_ult_conexao'] = '';
        1527| if ($rs = $this->Db->Execute($nm_comando))
        1528| {
        1529| $conteudo = (isset($rs->fields[0])) ? $rs->fields[0] : "";
        1530| $rs->Close() ;
        1531| }
        1532| elseif ($GLOBALS["NM_ERRO_IBASE"] != 1)
        1533| {
        1534| $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
        1535| exit;
        1536| }
        1537| $GLOBALS["NM_ERRO_IBASE"] = 0;
        1538| $this->nm_formatar_campos();
        1539| }
        ----------------------------------------------------------------------------

        Comment


        • #5
          Hello Mr. Willem,

          I recommend you to get in touch with our support team (as a trial user if your support is inactive) regarding the issues stated on your first post.

          regards,
          Bernhard Bernsmann

          Comment

          Working...
          X