On 500 error show a message on the right column

Hello, 


I was hoping that with a if then I could display some info on a page and when Iget a 500 error message , which I have changed to a 200 error, I could display a message that no data is found.


But I see now every time the message that no data is found. 

What did I do wrong ? 


Roelof

first of all check your error log in integrations of service center. Because, when you'll get an error from the Rest API, you are just ignoring it by setting the response code to '200'.

You can debug as well and check the Response.StatusLine.

KR Hans

Solution

Hi Roelof,

On your ColectionList Screen, the message "No data found" is displayed whenever "Details.Title" is empty:

In the Preperation, you set it to empty (not strictly necessary, since the Platform guarantees attributes are set to their default values). So the Screen always starts with the "No data found" message.

Next, you assign the Details Variable the output of the GetCollectionDetails response in the ShowDetail Screen Action, then Ajax Refresh the RighColumn container. The RighColumn container however is inside the If:

So you are refreshing the content of a container that's not shown in the first place! To solve this, give a name to the If that specifies the "Details.Title = """ condition, and Ajax Refresh that. Then you should see the behaviour your want.

Solution

yep, I did this because when I do not do this . I see a message with 500 error  on my screen and that is not what I want my users to see.  

Kilian Hekhuis wrote:

Hi Roelof,

On your ColectionList Screen, the message "No data found" is displayed whenever "Details.Title" is empty:

In the Preperation, you set it to empty (not strictly necessary, since the Platform guarantees attributes are set to their default values). So the Screen always starts with the "No data found" message.

Next, you assign the Details Variable the output of the GetCollectionDetails response in the ShowDetail Screen Action, then Ajax Refresh the RighColumn container. The RighColumn container however is inside the If:

So you are refreshing the content of a container that's not shown in the first place! To solve this, give a name to the If that specifies the "Details.Title = """ condition, and Ajax Refresh that. Then you should see the behaviour your want.

 

 Thanks, that seems to work.
Is there then a way I can make it work that when I open the site nothing is shown ?

Hi Roelof,

Sure, just use a different condition on that If, that's a tri-state between "just started the page", "got information" and "no detail information available". You could, for example, add a Status Attribute to that Structure, initialize it with "-1" to indicate you don't want to show anything, and set it to 0 or 1 depending on whether the retrieval went ok. Add an additional If around the current one, and use the right conditions: check on -1 for the outer one, showing nothing if True, or the other If if False etc.

P.S. Since my post above seems to have answered your original question, could you please mark it as Solution? Thanks.

sorry, I thought I did.


Next thing on my list. 

Look if I can make a layout like this : https://codepen.io/peterwestendorp/full/arwib