简体   繁体   English

基本 Mendix 应用程序 - ImageViewer 中未显示图像

[英]Basic Mendix app - Images not showing in ImageViewer

I'm brand new (4 days old,) at Mendix, and I'm trying to write a very basic expense application where expenses are entered, a receipt image (JPG) is uploaded for the expense.我是 Mendix 的新人(4 天大),我正在尝试编写一个非常基本的费用应用程序,其中输入费用,上传收据图像 (JPG) 用于费用。 and they are then sent for approval/rejection via another data grid page.然后通过另一个数据网格页面将它们发送以供批准/拒绝。 The Domain Model looks like this.域 Model 看起来像这样。 Domain Model域 Model

The problem is, I'm trying to use an image viewer to view the expense's associated image but no image appears.问题是,我正在尝试使用图像查看器查看费用的关联图像,但没有出现图像。 I've created a Microflow to get the image and display it in an ImageViewer.我创建了一个 Microflow 来获取图像并将其显示在 ImageViewer 中。 The Microflow looks like this: MicroFlow微流看起来像这样:

(The middle box is just a message used for debug purposes) The properties for Retrieving the ExpenseReceiptsUpload row is as follows: Get Row Properties (中间的框只是一个用于调试目的的消息)检索 ExpenseReceiptsUpload 行的属性如下: Get Row Properties

When the user clicks the 'View Receipt' button, the view image panel appears, but no image is shown.当用户单击“查看收据”按钮时,会出现查看图像面板,但没有显示图像。 Below are the properties for the 'View Receipt' button: View Receipt Button Properties Note that I am calling the correct GetImageMicroflow microflow.下面是“查看收据”按钮的属性:查看收据按钮属性请注意,我正在调用正确的 GetImageMicroflow 微流。

The layout for the Image Viewer Object is as follows: Image Viewer Object Image Viewer Object 的布局如下: Image Viewer Object

Why are the images not appearing?为什么图像不显示? I assume it has something to do with the association between my Expenses entity and my ExpensesReceiptsUpload entity but I feel like I've tried everything I can think of but I cannot get it to work!我认为这与我的 Expenses 实体和 ExpensesReceiptsUpload 实体之间的关联有关,但我觉得我已经尝试了我能想到的一切,但我无法让它发挥作用! Any words of wisdom would be greatly appreciated!!!任何智慧之言将不胜感激!!!

The association needs to be set during the save (commit) action or during the create action.需要在保存(提交)操作或创建操作期间设置关联。 So when you have the Microflow Action Create ExpensesReceiptsUpload you need to set the association to the Expenses object, when the object is committed this will be saved.因此,当您有 Microflow Action Create ExpensesReceiptsUpload 时,您需要将关联设置为 Expenses object,当 object 提交时,这将被保存。

Add this by opening the create action or commit action and click add, select the association, and fill in the value (such as $Expenses).通过打开创建操作或提交操作并单击添加来添加此项,select 关联,并填写值(例如 $Expenses)。

Since the association is 1-1 you are also allowed to set relation from the Expenses object.由于关联是 1-1,您还可以从费用 object 设置关系。 But since you probable create Expenses first, and then ExpensesReceiptsUpload, it makes sense to set the value for the association from the Create/Commit action for ExpensesReceiptsUpload, because then the value $Expenses will be available.但由于您可能首先创建 Expenses,然后是 ExpensesReceiptsUpload,因此从 Create/Commit 操作中为 ExpensesReceiptsUpload 设置关联值是有意义的,因为这样就可以使用 $Expenses 值。

Edit: i noticed you placed a debugger with the expenses ID, does this show an ID, if you change this to output the ExpensesReceiptsUpload id (or any other attribute of that object), you will notice if the object is available or not).编辑:我注意到您放置了一个带有费用 ID 的调试器,这是否显示了一个 ID,如果您将其更改为 output ExpensesReceiptsUpload id(或该对象的任何其他属性),您会注意到 object 是否可用)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM