[rules-users] Line breaks in DSLR

Stephen Masters stephen.masters at me.com
Tue Aug 27 14:25:49 EDT 2013


Every DSL template phrase must be written on a single line. That's just how the syntax works.

Hence why I do unfortunately have lines of DSL that are over 1000 characters long. :(

Steve



On 27 Aug 2013, at 19:14, Stefan <stefan at schiffer.at> wrote:

> I have written a simple DSLR-rule with a rather long sentence in the
> when-part:
> 
> 
> -----------------------------------------------------------------
> rule "NR3620"
>    when 
>        tariff number of a position starts with "0301" and the duty measure
> is one of "112", "122", "142", "141", "143" and code of condition is "M" and
> customs value of position is less than the reference value of condition
>    then   
> 	Error F3620
> end
> -----------------------------------------------------------------
> 
> When I try to break up the sentence into serveral lines for better
> readability I get an error. This does not word:
> 
> -----------------------------------------------------------------
> rule "NR3620"
>    when 
>        tariff number of a position starts with "0301" and 
>        the duty measure is one of "112", "122", "142", "141", "143" and
>        code of condition is "M" and 
>        customs value of position is less than the reference value of
> condition
>    then   
> 	Error F3620
> end
> -----------------------------------------------------------------
> 
> Here is the corresponding expander (line breaks at the lhs of the 5th
> when-clause are ok!):
> 
> -----------------------------------------------------------------
> [when]condition code=condCode
> [when]customs value=custValue
> [when]reference value=condAmount
> [when]less than=<=
> 
> [when]
> tariff number of a position starts with {tariffNumberPrefix} and
> the duty measure is one of {dutyMeasureCodes} and 
> code of condition is {conditionCode} and 
> {propPosition} of position is {comparator} the {propCondition} of condition
> =
> $measure:	DutyMeasure(
> 	tariffCode str[startsWith] {tariffNumberPrefix},
>   	addCodeNumber in ({dutyMeasureCodes})
> );            
> $condition:	Condition(
> 	condCode == {conditionCode}
> ) 
> $position:	ImportPosition(
>    tariffNumber str[startsWith] {tariffNumberPrefix},
>   	{propPosition} {comparator} $condition.{propCondition}
> );
> 
> [then]
> Error {code} = System.out.println("{code}");
> -----------------------------------------------------------------
> 
> Any idea how to break up the long DSL-sentence into several lines?
> 
> Thx Stefan
> 
> 
> 
> 
> --
> View this message in context: http://drools.46999.n3.nabble.com/Line-breaks-in-DSLR-tp4025707.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users




More information about the rules-users mailing list