GATHERING parts with same name part
i'm tryng to came up with a macro gathering parts with same part name.
I wrote this:
DEFINE unifica
local riga_tabella
local nome_parte_corrente
local id_parte_corrente
local nome_parte_confronto
local id_parte_confronto
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) }
pb_ltab_update
LET lista_parti 'PBT_LTAB'
let riga_tabella 1
LOOP
LET riga_tabella (riga_tabella+1)
EXIT_IF (riga_tabella>(LTAB_ROWS lista_parti))
let nome_parte_confronto (READ_LTAB lista_parti 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 lista_parti riga_tabella 2)
{ let id_parte_confronto ("~"+ STR id_parte_confronto) }
if (id_parte_corrente <> id_parte_confronto)
if (nome_parte_corrente = nome_parte_confronto)
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
pb_ltab_update
LET lista_parti 'PBT_LTAB'
end_if
end_if
let riga_tabella (riga_tabella + 1)
END_LOOP
end
end
edit_part top
The "funny" thing is that the loop
..
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
pb_ltab_update
LET lista_parti 'PBT_LTAB'
..
works fine if i insert each command using command line imput, fails if i lunch the macro
Any idea?
P.S. I'm not english mother toungue. I beg your pardon for my english.
|