2016-11-12 3 views
0

私は次のような条件を作成しています:のDrools - ダブル量

$event : EventObject(type=='Sale', $points:points, $playerid:playerid) from 
entry-point eventstream 

私は次のように変数を渡す必要がありこの結果:以下

boolean givePointsToPlayer(String playerId, 
         String pointType, 
         double amount, 
         String notificationMessage) 

最も基本的な例です。私はこのプレーヤーに3点を与えます。

updateAPIv1.givePointsToPlayer($playerid, 'Points', 3, 'Points Awarded'); 
update(engine.getPlayerById($playerid)); 

しかし、私は$ points:pointsを 'double amoun t 'である。

簡単な質問私は知っていますが、どのようにすればよいでしょうか?何かのようなもの?

$points=double amount; 
updateAPIv1.givePointsToPlayer($playerid, 'Points', amount, 'Points Awarded'); 
update(engine.getPlayerById($playerid));; 

フィードバックを感謝します。ありがとう。

***アップデート私も

$event : EventObject(type=='Sale', $points:points, $playerid:playerid) 
      from entry-point eventstream  

updateAPIv1.givePointsToPlayer($playerid, 'Points', $points, 'Points Awarded'); 
update(engine.getPlayerById($playerid));  

を試してみましたが、私はこの上の任意の考え、この

"Unable to create Field Extractor for 'points' 
    Field/method 'points' not found for class 'com.sap.gamification.model.EventObject" 
    "Rule Compilation error $points cannot be resolved " 

ため、次のエラーを取得しますか?

答えて

0

これは無効なステートメントなので、Javaの構文に非常に追いつくべきです。

$points=double amount; 

しかし、あなたはその結果に別の変数にバインドされた変数($points)の値を格納する必要はありません。

ファクトフィールドにバインドされた変数は「最終的な」変数と考えることができますが、値にアクセスできますが変更することはできません。

編集これは、あなたが持っていることを前提とします。返信用

public class EventObject { 
    private double points; 
    public double getPoints(){ return points; } 
    // ... rest of class 
} 
+0

感謝を。私はそれを試して、それは動作しませんでした:$ event:EventObject(type == 'Sale'、$ points:points、$ playerid:playerid)entrystream eventstreamupdateAPIv1.givePointsToPlayer($ playerid、 'Points'、 $ポイント、 'ポイント獲得'); update(engine.getPlayerById($ playerid)); – MacAodh

+0

上記の更新を参照してください – MacAodh

+0

私の答えに編集を参照してください。 – laune