Review

215 阅读3分钟

User Role

默认情况下,仅在Screen设置Roles,页面访问权限是“”的关系;若要设为“”的关系,需要对Screen进行权限检查CheckRole()image.png

初始0勾选:

  • 一旦勾选Anonymous,则剩余权限全部会被自动勾选
  • 一旦勾选Register,则除Anonymous权限外的全部权限会被自动勾选

image.png

给屏幕设置访问权限分为两步:

  1. 对屏幕的Role属性进行勾选访问权限(默认是“或”的关系)
  2. (若需要修改默认)在访问屏幕的入口时调用server action对权限进行Check

异常

题解:CreateOrUpdateClass是属于数据库操作行为,所以在数据库操作行为中抛出异常,便属于数据异常,DatebaseException image.png

题解:如图所示,首位异常是SecurityException,但是在它的执行上下文中并没有响应的Exception Handle,所以该异常会按照冒泡的行为向上查找可以对应的异常处理,只有AllException符合,AllException可以处理所有的异常。 image.png

Debug

题解:首先在debug中,执行Continue会跳到下一个断点处,看流程图,输入N=2,它会执行结束,且sqrt=Sqrt(2),不会跳到断点处。 image.png

image.png

聚合计算

  1. 如何计算每一个订单的总价格包含VAT(增值税)?

  2. 使用什么方法可以在聚合的输出中ignore cancle state? 如何写filter语句 <>

  3. 聚合返回值中的MaxCount代表什么意思? 聚合返回元素element的总数

问题:计算每一只股票的总价格?

步骤:首先对Stock进行Group by,然后对Price列使用聚合函数Sum image.png

问题: 计算每一只股票的总价格(去税后)

步骤:先对Stock进行Group by,会把重复的数据进行整理,然后新增一个计算属性,用来计算每个股票去税后的价格,最后使用聚合函数Sum对去税后的价格列进行求和 image.png

Form

问题:

在screen上有一个Form,Form内存在多个Input,当用户对input填充完毕后,此时它的值会被存储到哪里? 选项:

  • A.与实体属性相关联的Form
  • B.与变量相关的input files
  • C.与局部变量相关的Form

Button and Link

问题:

下面那个不能作为link的on click Destination?

  • A. Client action
  • B. Event
  • C. Screen
  • D. Server action

Client variable

什么情况下,client variable会恢复到默认值?

  • A 关闭浏览器
  • B user log in
  • C user log out

Lifecycle

什么情况下会执行On After?

Modular Dependencies

如何查看相关的log? 点击Modul Management in Service Center image.png 点击查看Modular Dependencies相关知识

Data Action

在屏幕加载后,使用数据操作从数据库或外部系统获取复杂数据。数据操作在服务器上运行。

数据操作和客户端聚合在屏幕加载后并发地开始获取数据。

并发 并行

「并发」是同学们排成两队,然而却只有一个咖啡机在工作,所以两个队列排在前面的同学交替使用咖啡机;(类似线程)

「并行」则是两台咖啡机分别服务两个独立的同学队列,它们同时进行,互不干扰(类似进程)

不要在Data Actions中执行登录操作,期望在其On After Fetch事件中使用GetUserId()函数。在屏幕中并行执行数据操作和客户端聚合会覆盖会话身份验证cookie。在On After Fetch事件中使用GetUserId()函数可能返回一个空值。

标识定义作用域中的元素,如屏幕、操作或模块。 聚合从数据源获取数据后执行的操作。

可操作界面: image.png

Properties

NameDescriptionMandatoryDefault valueObservations
NameIdentifies an element in the scope where it is defined, like a screen, action, or module.Yes
DescriptionText that documents the element.Useful for documentation purpose. The maximum size of this property is 2000 characters.
Server Request TimeoutMaximum time in seconds to wait for the Data Action to return data before triggering a Communication Exception. Overrides the default timeout defined on the module.
FetchYesAt start
Events
On After FetchAction executed after the aggregate fetches data from the data source.

Runtime Properties

NameDescriptionRead OnlyTypeObservations
IsDataFetchedTrue when data has been fetched from the database and is ready to be used.YesBoolean
HasFetchErrorTrue when there is an error during data fetch due to a server error or communication timeout.YesBoolean