Codeunit "Text Postprocessor UTCAP"
ID 70344799
Namespace: CapVision.Core.Parsers
Ce composant permet de traiter des blocs conditionnels ou de réaliser des calculs au sein d'une chaîne de caractères à l'aide de formules.
Ce module est conçu pour être appliqué après Record Relation Parser.
Pour marquer un bloc conditionnel, utilisez la syntaxe ci-dessous :
?[<Name>:<Condition>]
<Content>
?[<Name>]
- : le nom de la condition. Le nom de la balise de début doit correspondre au nom de la balise de fin.
- : expression booléenne. Si la valeur est vrai, le contenu est affiché, sinon, le contenu n'est pas affiché. La syntaxe repose sur une expression booléenne XPath.
- : texte à afficher.
Pour marquer un calcul à réaliser, utilisez la syntaxe ci-dessous :
#[<Expression>]
- : expression arithmétique dont vous souhaitez obtenir le résultat. La syntaxe repose sur une expression XPath.
Examples
L'exemple ci-dessous affiche le texte uniquement si la remise (25) est strictement positive.
Dans un cas plus réaliste, remplacez 25 par {"Discount %"} par exemple et faites passer votre chaîne de caractères via Record Relation Parser en premier lieu.
var
TextPostprocessor: Codeunit "Text Postprocessor UTCAP";
Result: Text;
begin
Result := TextPostprocessor.Process('?[HasDiscount:25 > 0]Vous bénéficiez d'une remise de 25 %.?[HasDiscount]')
Message(Result);
end;
L'exemple ci-dessous affiche 100.
var
TextPostprocessor: Codeunit "Text Postprocessor UTCAP";
Result: Text;
begin
Result := TextPostprocessor.Process('#[25*4]')
Message(Result);
end;
Properties
| Name |
Value |
| SingleInstance |
True
|
| Access |
Public
|
Methods
GetErrorToken
Renvoie la valeur utilisée lorsqu'une substitution a échoué.
procedure GetErrorToken(): Text
Returns
Process
procedure Process(InputText: Text): Text
Parameters
| Name |
Type |
Description |
|
InputText
|
Text |
|
Returns
Events
OnBeforeGetErrorToken
[IntegrationEvent(False,False)]
local procedure OnBeforeGetErrorToken(var Token: Text, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
Token
|
Text |
|
|
Handled
|
Boolean |
|
OnBeforeProcess
[IntegrationEvent(False,False)]
local procedure OnBeforeProcess(InputText: Text, var OutputText: Text, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
InputText
|
Text |
|
|
OutputText
|
Text |
|
|
Handled
|
Boolean |
|
OnAfterProcess
[IntegrationEvent(False,False)]
local procedure OnAfterProcess(InputText: Text, var OutputText: Text)
Parameters
| Name |
Type |
Description |
|
InputText
|
Text |
|
|
OutputText
|
Text |
|
OnBeforeStrSubstConditionalRegex
[IntegrationEvent(False,False)]
local procedure OnBeforeStrSubstConditionalRegex(InputString: Text, RegexString: Text, var OutputString: Text, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
InputString
|
Text |
|
|
RegexString
|
Text |
|
|
OutputString
|
Text |
|
|
Handled
|
Boolean |
|
OnAfterStrSubstConditionalRegex
[IntegrationEvent(False,False)]
local procedure OnAfterStrSubstConditionalRegex(InputString: Text, RegexString: Text, var OutputString: Text)
Parameters
| Name |
Type |
Description |
|
InputString
|
Text |
|
|
RegexString
|
Text |
|
|
OutputString
|
Text |
|
OnBeforeInterpretCondition
[IntegrationEvent(False,False)]
local procedure OnBeforeInterpretCondition(ConditionToken: Text, var ReturnValue: Boolean, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
ConditionToken
|
Text |
|
|
ReturnValue
|
Boolean |
|
|
Handled
|
Boolean |
|
OnAfterInterpretCondition
[IntegrationEvent(False,False)]
local procedure OnAfterInterpretCondition(ConditionToken: Text, var ReturnValue: Boolean)
Parameters
| Name |
Type |
Description |
|
ConditionToken
|
Text |
|
|
ReturnValue
|
Boolean |
|
OnBeforeInterpretCalculationToken
[IntegrationEvent(False,False)]
local procedure OnBeforeInterpretCalculationToken(CalculationToken: Text, var ReturnValue: Decimal, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
CalculationToken
|
Text |
|
|
ReturnValue
|
Decimal |
|
|
Handled
|
Boolean |
|
OnAfterInterpretCalculationToken
[IntegrationEvent(False,False)]
local procedure OnAfterInterpretCalculationToken(CalculationToken: Text, var ReturnValue: Decimal)
Parameters
| Name |
Type |
Description |
|
CalculationToken
|
Text |
|
|
ReturnValue
|
Decimal |
|
OnBeforeStrSubstCalculationRegex
[IntegrationEvent(False,False)]
local procedure OnBeforeStrSubstCalculationRegex(InputString: Text, RegexString: Text, var OutputString: Text, var Handled: Boolean)
Parameters
| Name |
Type |
Description |
|
InputString
|
Text |
|
|
RegexString
|
Text |
|
|
OutputString
|
Text |
|
|
Handled
|
Boolean |
|
OnAfterStrSubstCalculationRegex
[IntegrationEvent(False,False)]
local procedure OnAfterStrSubstCalculationRegex(InputString: Text, RegexString: Text, var OutputString: Text)
Parameters
| Name |
Type |
Description |
|
InputString
|
Text |
|
|
RegexString
|
Text |
|
|
OutputString
|
Text |
|
See also