Expression is set of statement or syntax which represent what you want to show at this compute field. Can be static text, calculation, or the other things.
When you create a datawindow and insert a compute field object, you can set the expression visually. But some times, you want to change the expression statement dynamically, which mean the expression will change depending of condition. Let say, if one of condition is fulfilled, you want to show: OK in the compute field, otherwise is NO.
Let say, in a Datawindow named dw_1, we create 1 compute object named co_1. The default expression is if(kd_kategori=2,'OK','NO'). It's mean if kd_kategori's value is 2, then we want to show text: OK, otherwise is: NO.
But, in some condition you want to change the default expression into if(kd_kategori=200,'OK','NO'), let say if someone in STAFF level is accessing the application.
Then you must create a script like below:
1: IF userlevel='STAFF' THEN
2: dw_1.object.co_1.expression = "if(kd_kategori=200,'OK','NO')"
3: ELSE
4: dw_1.object.co_1.expression = "if(kd_kategori=2,'OK','NO')"
5: END IF
No comments:
Post a Comment