10
Views
3
Comments
Solved
Blocks Exercise - Can´t Get Image content property

I am doing the Block Exercise from the guided Path.

I'm following the directions from .PDF file but when i reached point 12. I'm stuck with an error that i simply don't understand.


Block Exercise .PDF

12. Change the Type property to Binary Data and then set the Image Content property to:

GetEmployeeById.List.Current.EmployeePicture.Picture


First: - I don't understand if I need to know that fuction from memory or if i need to get it from somewhere?
Second: If I need to get it in the Function options...I've pressed every single option and still can't find it.
Third: - Even when I do Copy paste from the pdf i still have an error...

"Can't Identify 'GetEmployeeById' element in expression"

What am I doing wrong?

Ps.: Thought outsystems was easier! (zero experience programing) 



Rank: #143
Solution

Hello Bruno,


In OutSystems, when you want to show an image, you can use the Image widget:

If you use this in a screen, you need to define the type of that image. That's why you have a Type property.

The Type property can have one of these options:

  • Local Image - The image is imported in the Images folder of your module or another module if its Public property is set to Yes;
  • External URL - You need to define an URL to get the image;
  • Binary Data - The image is stored somewhere as a Binary Data and you can simply pass this Binary in here.


With that said, if you have a Binary Data attribute in your entity, you can save a binary into the database.

And that's exactly what is happening in here :)

Your entity EmployeePicture has a Binary Data attribute called Picture (Binary Data) where you can store a binary into the database.


Most likely, GetEmployeeById is an Aggregate where you should fetch this information from the database (with the respective sources - Employee and EmployeePicture).

After this, you should pass this attribute into the Image Content property of the image in order to render the image:

GetEmployeeById.List.Current.EmployeePicture.Picture


But somehow you're missing this Aggregate (maybe you skipped some steps) in your screen and that's why you have this error:

"Can't Identify 'GetEmployeeById' element in expression"


So, you need to place this Aggregate (called GetEmployeeById) in your screen, associated to your Employee and EmployeePicture entities, and after this you should be able to pass this attribute to your image.


Hope that this helps you!


Kind regards,

Rui Barradas

Rank: #89

HI Bruno,

Basically GetEmployeeByID is your aggregate name , which fatch data from agreegate based on EmployeeID

See below image


GetAccountCategoryByID is aggregate fatch data by AccountID and bind this attributes with form inputs.

If GetEmployeeByID is not exsis then create one aggregate by employeeid and use it


Hope this will help you.


Regards

Rahul Sahu

mvp_badge
MVP
Rank: #74

Hi Bruno,

In the previous steps 3 to 6 of the exercise, you have added an Aggregate to the EmployeeDetail Block using the EmployeeId input parameter.

If you have executed these steps correctly, you should have an Aggregate with the name GetEmployeeById available in your EmployeeDetail block. The error you have right now indicates that this element does not exist.

Go over these steps again and make sure you end up with the GetEmployeeById aggregate so that GetEmployeeById.List.Current.EmployeePicture.Picture will get recognized by the expression editor.

Hope this helps!

Regards,

Nordin