ON AFTER INSERT – ID PROBLEM

QuestionsON AFTER INSERT – ID PROBLEM
Thales asked 5 years ago

Hello, Abu!

When I use the event ON_AFTER_INSERT, the Array DATA, do not recognize my IDs ZW1_NROPOR and ZW1_REVISA.

This Fields are READ ONLY, because the SQL DATABASE controls the SEQUENCE (IDENTITY).

How can I Access this Data? Can you help me?

Look the font above:

$e[“on_after_insert”] = array(“after_insert”, null, true);
$g->set_events($e);

function after_insert($data)
{
global $grid;
phpgrid_error($data);

$grid->execute_query(“INSERT INTO PROPOSTA(ZW2_PROPOS,ZW2_REVISA,ZW2_TITULO,ZW2_DATA,ZW2_OPORTU)
VALUES (‘{$data[“params”][“ZW1_NROPOR”]}’
,'{$data[“params”][“ZW1_REVISA”]}’
,'{$data[“params”][“ZW1_DESCRI”]}’
,'{$data[“params”][“ZW1_DTINI”]}’
,'{$data[“params”][“ZW1_NROPOR”]}’)”);
}

Array ( [ZW1_NROPOR] => _empty [params] => Array ( [ZW1_NROPOR] => [ZW1_REVISA] => [ZW1_MSBLQL] => A [ZW1_PEDIDO] => [ZW1_COMERCIAL] => [ZW1_DTINI] => 20191212 [ZW1_CODCLI] => 00124501 [ZW1_DESCRI] => TEDE DE ENTRADA PARA GRAVAÇÃO [ZW1_USINCL] => [ZW1_PROVEN] => [ZW1_STAGE] => [ZW1_NOTAS] => [ZW1_NOTASCHECK] => [ZW1_FEELIN] => A [ZW1_PRIOR] => B [ZW1_COMUNI] => T [ZW1_VEND01] => 00002 [ZW1_VEND02] => 00002 [ZW1_VEND03] => 000102 [ZW1_VEND04] => 00006 [ZW1_VEND05] => [ZW1_ELETRICA] => [ZW1_DTELESOL] => NULL [ZW1_DTELEPRE] => NULL [ZW1_DTELECON] => NULL [ZW1_ELENOTAS] => [ZW1_ARQELETRICA] => [ZW1_DTC] => [ZW1_DTDTCSOL] => NULL [ZW1_DTDTCPRE] => NULL [ZW1_DTDTCCON] => NULL [ZW1_DTCNOTAS] => [ZW1_ARQDTC] => [ZW1_DTM] => [ZW1_DTDTMSOL] => NULL [ZW1_DTDTMPRE] => NULL [ZW1_DTDTMCON] => NULL [ZW1_DTMNOTAS] => [ZW1_ARQDTM] => [ZW1_FRETE] => [ZW1_DTFRESOL] => NULL [ZW1_DTFREPRE] => NULL [ZW1_DTFRECON] => NULL [ZW1_FRENOTAS] => [ZW1_ARQFRETE] => [ZW1_DTFIM] => NULL [ZW1_FCS] => [ZW1_FCI] => [ZW1_MOTIVOS] => [ZW1_MOTIVO] => [ZW1_PROPOSTA] => [IDIOMA] => PT [ANEXO] => ) )

 

5 Answers
Abu Ghufran Staff answered 5 years ago

To get a field posted back to server, you need to set it $col[“editable”] = true;

Only editable fields are post back. What you do is to set them $col[“hidden”] = true; then it will not be shown.

Let me know if not resolved.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Abu Ghufran Staff answered 5 years ago

To get a field posted back to server, you need to set it $col[“editable”] = true;

Only editable fields are post back. What you do is to set them $col[“hidden”] = true; then it will not be shown.

Let me know if not resolved.

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Thales answered 5 years ago

Hi Abu,

Look my field Declarartions.

Editable=true

 

$col = array();
$col[“title”] = “Oportunidade”;
$col[“name”] = “ZW1_NROPOR”;
$col[“width”] = “100”;
$col[“editable”] = true;
$col[“hidden”] = false;
$col[“editoptions”] = array(“tabindex”=>”.++$ind.”, “readonly”=>”readonly”, “style”=>”border:1; color:red;”);
$cols[] = $col;

$col = array();
$col[“title”] = “Revisão”; // caption of column
$col[“name”] = “ZW1_REVISA”;
$col[“width”] = “90”;
$col[“editable”] = true;
$col[“editoptions”] = array(“tabindex”=>”.++$ind.”, “readonly”=>”readonly”, “style”=>”border:1; color:red;”);
$col[“align”] = “right”;
$cols[] = $col;

 

$col = array();
$col[“title”] = “Oportunidade”;
$col[“name”] = “ZW1_NROPOR”;
$col[“width”] = “100”;
$col[“editable”] = true;
$col[“hidden”] = false;
$col[“editoptions”] = array(“tabindex”=>”.++$ind.”, “readonly”=>”readonly”, “style”=>”border:1; color:red;”);
$cols[] = $col;

$col = array();
$col[“title”] = “Revisão”; // caption of column
$col[“name”] = “ZW1_REVISA”;
$col[“width”] = “90”;
$col[“editable”] = true;
$col[“editoptions”] = array(“tabindex”=>”.++$ind.”, “readonly”=>”readonly”, “style”=>”border:1; color:red;”);
$col[“align”] = “right”;
$cols[] = $col;

Thales answered 5 years ago

ABU, I create a Database Trigger to solve the problem. You can close the POST. Thank you.

Abu answered 5 years ago

Ok, thanks for the update.

Your Answer

1 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?