Get parameter values sent in a representation URL
A URL corresponding to a representation can have additional parameters sent with the syntax ¶meter=value
at the end of the main URL. It might be important for a developer using this representation to get the corresponding parameter values if they exist.
The corresponding method can be used on any representation:
PARAMVALUE= fmet MYREP.AGETVALPARAMURL ("PARAMNAME")
PARAMNAME
is the name of the parameter.For example: Let us consider that you have a representation called YORDER where you want to have a field called WARNINGMES in your query representation. But as the warnings may concern different fields, you want to select the field by having an additional parameter called field
.
The code would be, in this case, located on the AQUERY_TRANS_AFTER event:
$AQUERY_TRANS_AFTERLocal Char FIELD(30)FIELD=fmet this.AGETVALPARAMURL("field")If FIELD="finance"this.YOR.WARNINGMES=string$([YOH]TOTAL>1000,"Financial risk")Elsif FIELD="inventory"this.YOR.WARNINGMES=string$([YOH]FCY="001","Frequent shipping delays")Elsif FIELD="manager"this.YOR.WARNINGMES=[YOH]COMMENTElsethis.YOR.WARNINGMES=""EndifReturn
.../sdata/x3/erp/MYFOLDER/YORDER?representation=YORDER.$query&field=finance
.../sdata/x3/erp/MYFOLDER/YORDER?representation=YORDER.$query&field=inventory
.../sdata/x3/erp/MYFOLDER/YORDER?representation=YORDER.$query&field=manager
.../sdata/x3/erp/MYFOLDER/YORDER?representation=YORDER.$query
The result displayed on the warning columns would then be different.