Hi everyone,
I need advice on a particular code that I need to change using the pre processor
For example:
.PRG looks like this
Code: Select all
IF &xALIAS->PERIOD#MPERIOD2 .OR. &xALIAS->STATUS='C' .OR. &xALIAS->TRCDE#'0'
ENDIF
IF xARRAY[xP,aORDQTY]=INVENTORY->QOH+xARRAY[xP,oORDQTY] .AND. xARRAY[xP,aORDQTY] # 0
endif
.CH looks like this
Code: Select all
#xtranslate IF <table>-><field>#<something> => ;
IF <table>:FieldGet(#<field>) \# <something>
#xtranslate .OR. <table>-><field>=<something> => ;
.OR. <table>:FieldGet(#<field>)=<something>
#xtranslate .OR. <table>-><field> \# <something> => ;
.OR. <table>:FieldGet(#<field>) \# <something>
#xtranslate .AND. <table>-><field>=<something> .OR. => ;
.AND. <table>:FieldGet(#<field>)=<something> .OR.
the resulting .ppo look like this
Code: Select all
IF &xALIAS:FieldGet("PERIOD") # MPERIOD2 .OR. &xALIAS:FieldGet("STATUS='C' .OR. &xALIAS->TRCDE") # '0'
ENDIF
IF xARRAY[xP,aORDQTY]=INVENTORY:FieldGet("QOH+xARRAY[xP,oORDQTY] .AND. xARRAY[xP,aORDQTY]") # 0
ENDIF
BUT what I need is like this
Code: Select all
IF &xALIAS:FieldGet("PERIOD") # MPERIOD2 .OR. &xALIAS:FieldGet("STATUS")='C' .OR. &xALIAS:FieldGet("TRCDE") # '0'
ENDIF
IF xARRAY[xP,aORDQTY]=INVENTORY:FieldGet("QOH") +xARRAY[xP,oORDQTY] .AND. xARRAY[xP,aORDQTY] # 0
ENDIF
I need some pointers about using pre-processor for this kind of replacement.
As the number of code that need to be changed is quite a lot (4-5 months worth of work if to change manually), am I approaching this issue the right way (by using pre-processor)?
OR
Is it possible to create a generic translate command that can handle any number .AND., .OR., and arithmatic operators?
Say I have a
Code: Select all
IF A->B + C -A->D * E=<memvariable> .AND. A->F > 0
that needs to be translated into
Code: Select all
IF A:FieldGet('B') + C - A:FieldGet('D') * E=<memvariable> .AND. A:FieldGet('F') > 0
, Is it possible to create just one line of #translate to handle it?
Any pointers on how I can approach this issue, will be greatly appreciated.
Best Regards,
Andy Edward Gunawan