Jump to content
The ibi Community has moved to a new platform: Please Sign In and choose Forgot Password to continue

regex backreference and xpath request


Recommended Posts

In iWay integration tool (8.0.6), is it possible de call for a regex backreference within an _xpath function call ? 
For instance:
_regex(_sreg('SupannEmpProfil',''),'\\[affect=([0-9A-Z]+)\\]',
_concat('\\[affect=',_xpath(//domaine/donnees/operation/personne/rattachements/rattachement/roles/role/personneRessource/affectations/affectation[identifiantStructureInterne=$1]/referenceCroisee/identifiantsExternes[identifiantApplication='SINAPS_OPI']/identifiantExterne),'\\]'))
 
I found that the back reference is accessible with $1. It works fine outside the xpath.
For instance 
regex(_sreg('SupannEmpProfil',''),'\\[affect=([0-9A-Z]+)\\]',$1) works. It works also with a _concat function. 
 
In this way, 
_regex(_sreg('SupannEmpProfil',''),'\\[affect=([0-9A-Z]+)\\]',_concat('\\[affect=',_eval(_concat('_xpath(//domaine/donnees/operation/personne/rattachements/rattachement/roles/role/personneRessource/affectations/affectation[identifiantStructureInterne=\'',$1,'\']/referenceCroisee/identifiantsExternes[identifiantApplication=\'SINAPS_OPI\']/identifiantExterne)')),'\\]'))
 
It doesn't work as well event if the xpath request is well constructed. 
the result is:  [affect=]
 
An example for the attribute SupannEmpProfil:
[etab={UAI}XXXT][affil=staff][corps={NCORPS}XXX][typeaffect={SUPANN}SXXX][affect=DNU3G][activite=][datefin=]|[etab={UAI}XXXX][affil=staff][corps={NCORPS}XXX][typeaffect={SUPANN}XXXX][affect=DNU][activite=][datefin=]
 
Thanks by advance for any help
 
Best regards
 
 
 
Link to comment
Share on other sites

Hello,

When calling multiple IFL (iWay Functional Language) functions it is best practivce to use _concat(). Try removing the multiple _concat() calls. Instead use the IFL you are concatinating in separate special registers then use a single _concat with the defined special registers i.e. _concat(_sreg(myregex),_sreg(myaffact), _sreg(myxpath),_sreg(mybackref)...)

Note: _concat - Concatenate any number of items. Operators are not evaluated.

Hope this helps.

Regards,

Link to comment
Share on other sites

Posted (edited)

Hi, 

Thanks a lot for your answer. 

Actually i don't kown how to put the backreference as a special register, as it works only within the regexp. Within the _concat $1 is well interpreted, problem is within the _xpath. Also the xpath request is based on the backreference so i don't if it is possible to set it in the register before calling the _regexp.

Using something close to one _concat is contructing the text of the whole _xpath call and then using _eval but even if the request is well construted, the _eval doen't execute the _xpath. So actually i don't know how the _eval function really work. 

Anyway thanks again for your help

Best regards

Edited by nadir
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...