1380:VALUE ERROR: ....

MiServer is Dyalog's APL-based web development framework
Post Reply
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

1380:VALUE ERROR: ....

Post by Gantois »

Hi !

what could I do to avoid the following error:
1380:VALUE ERROR: No result was provided when the context expected one

DoAction[28] q_numq←(1+⍎⍕q_numq)⌊iprova.TotalQuestoes idprova

This error occurs when the user has no action in browser for some period of time. I think I have to take action in "onSessionEnd" to "close" the section variables active, but I don't know how to do this.

Thanks,
Marco
User avatar
kai
Posts: 141
Joined: Thu Jun 18, 2009 5:10 pm
Location: Hillesheim / Germany

Re: 1380:VALUE ERROR: ....

Post by kai »

You need to look at ⎕VFI.

However, the statement ⍎⍕q_numq means that something is wrong here. If the variable is numeric, something the name seams to suggest, then there is no need to make it text and then execute the text.

If it is text then there is no need for the ⍕.

If you don't know whether it is numeric or not then make sure that you do.
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

Re: 1380:VALUE ERROR: ....

Post by Gantois »

Hi Kai,

Thanks for your response.
My problem is not specifically this instruction but the fact that an error occurs whenever the user has no action in browser for some period of time. this can occurs in another instruction using variables passed between server and browser.

Greetings
User avatar
Brian|Dyalog
Posts: 120
Joined: Thu Nov 26, 2009 4:02 pm
Location: West Henrietta, NY

Re: 1380:VALUE ERROR: ....

Post by Brian|Dyalog »

Hi Marco,

The situation is probably that the user's session timed out. When that happens, all the instances of pages that are kept with the user's session are expunged. However, the browser doesn't know anything about what happens on the server side, so, it just submits the request.
When the request is received by the server, it creates a new instance of the page (but of course, without the variables that where set up in the previous instance). That's the reason for the VALUE ERROR.

Here are a couple of ways to address this.
  1. Code defensively - check for the existence of the variables, or provide an error trap, that will have the user log in again, or do whatever to reestablish the environment he needs to run in.
  2. Create a constructor for the page that sets a flag to indicate this is a new page instance. Then check that flag when the page's code is executed.

    Code: Select all

      ∇make
    :Access Public
    :Implements Constructor
      NewPage←1
      ∇

    Then in your page's code, do something like:

    Code: Select all

    :If NewPage=1
      :If   ⍝ we're just rendering the page for the first time
            ⍝ or we don't have variables whose existence we depend on
        NewPage←0
        ⍝ Normal processing here
      :Else
        ⍝ redirect the user or reestablish the variables here
      :EndIf
    :EndIf

I hope this helps!
/Brian
Gantois
Posts: 91
Joined: Thu Apr 17, 2014 9:44 am

Re: 1380:VALUE ERROR: ....

Post by Gantois »

Thanks Brian
Att, Marco
Post Reply