#1
|
|||
|
|||
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. |
#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 |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | Rate This Thread |
|
|