View Single Post
  #2  
Old 06-04-2015, 08:49 AM
painaz painaz is offline
Registered User
 
Join Date: Jun 2015
Posts: 2
Re: GATHERING parts with same name part

i found a solution, works fine. I'd like share it:

DEFINE unifica

local riga_tabella

local nome_parte_corrente
local id_parte_corrente
local id_parte_corrente_num

local nome_parte_confronto
local id_parte_confronto
local id_parte_confronto_num

local lista_parti

inq_env 7
let nome_parte_corrente (inq 301)
let nome_parte_corrente (TRIM nome_parte_corrente)
{let nome_parte_corrente (SUBSTR nome_parte_corrente 1 8)}

inq_env 7
let id_parte_corrente (inq 302)
let id_parte_corrente (STR "~"+id_parte_corrente)
{ let id_parte_corrente_num (NUM id_parte_corrente_str) }

EDIT_PART TOP

pb_ltab_update
LET lista_parti 'PBT_LTAB'
LET riga_tabella (1)

while ( riga_tabella <= ltab_rows "PBT_LTAB" )
let nome_parte_confronto (READ_LTAB "PBT_LTAB" riga_tabella 1)
let nome_parte_confronto (TRIM nome_parte_confronto)
{let nome_parte_confronto (SUBSTR nome_parte_confronto 1 8)}
let id_parte_confronto (READ_LTAB "PBT_LTAB" riga_tabella 2)
{ let id_parte_confronto_num (NUM id_parte_confronto_str) }
if (id_parte_corrente = id_parte_confronto)
{ display ("=") }
else
{ display ("entro in else") }
{ display (id_parte_corrente) }
{ display (id_parte_confronto) }
{ display (nome_parte_corrente) }
{ display (nome_parte_confronto) }
if (nome_parte_corrente = nome_parte_confronto)
TRAP_ERROR
{ display ("unifico") }
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
end_if
end_if
let riga_tabella (riga_tabella + 1)
end_while
edit_part top
END_DEFINE
Reply With Quote