2016-11-12 68 views
0

我创建像条件如下:滴料 - 双量

$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 to'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)的值存储在后果另一个变量。你可以写这个调用:

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

思考的必然事实领域“最后的”变量变数:你可以访问值,但不能改变它。

编辑这假定您有:

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

感谢您的答复。我已经尝试过,并没有奏效,例如:$ event:EventObject(type =='Sale',$ points:points,$ playerid:playerid)from entry-point eventstreamupdateAPIv1.givePointsToPlayer($ playerid,'Points', $积分,'积分奖励'); update(engine.getPlayerById($ playerid)); – MacAodh

+0

查看更新以上 – MacAodh

+0

请参阅编辑我的答案。 – laune