Four Js Development Tools Forum

Discussions by product => GAS and GBC => Topic started by: Rodrigo V. on February 20, 2014, 12:19:01 pm



Title: application/state/ended/error & USER LIMIT EXCEEDED
Post by: Rodrigo V. on February 20, 2014, 12:19:01 pm
Hello,

Is it posible to show a 'USER LIMIT EXCEEDED' message in GAS when the application was ended by #user license limit? We try to use application/state/ended/error and some other values at EndingPage Snippet but it looks like no ERROR is raised when the app was ending by license limit.

Thanks!


Title: Re: application/state/ended/error & USER LIMIT EXCEEDED
Post by: . on February 24, 2014, 03:52:15 pm

Hi Rodrigo,

Unfortunately, if your need is to display the FGL error message "user limit exceeded" on browser, there is no solution for the moment.
I invite you to contact your support center if you want us to register a feature request for this.

Regards,
Guney
 


Title: Re: application/state/ended/error & USER LIMIT EXCEEDED
Post by: Rodrigo V. on February 24, 2014, 04:30:35 pm
Thanks Guney,

I'll do it.

Rodrigo


Title: Re: application/state/ended/error & USER LIMIT EXCEEDED
Post by: Andrew B. on March 17, 2014, 06:30:01 pm
Hi there,
Reuben provided this get around which works ok for us. It has to run at the very start of the program before there is any user or screen interactions.
 If the function returns true we use "ui.Interface.frontCall" to display a PDF document telling the user the license count had been exceeded and exit the menu system. This works for GAS as well as GDC.


#Name       : license_exceeded()
#Description: function to check 4J's Licence count
#Parameters : -
#Returns    : TRUE if no programs running else FALSE

FUNCTION license_exceeded()
DEFINE ch base.Channel
DEFINE line STRING
DEFINE tok base.StringTokenizer
DEFINE in_use, limit INTEGER

    LET ch = base.Channel.create()
    CALL ch.openPipe("fglWrt -a info users", "rw")

    WHILE TRUE
        LET line = ch.readLine()
        IF ch.isEof() THEN
            EXIT WHILE
        END IF
        IF line.subString(1,5) = "Users" THEN
            LET tok = base.StringTokenizer.createExt(line.subString(16, line.getLength()), "/","", TRUE)
            LET in_use = tok.nextToken()
            LET limit = tok.nextToken()
            IF in_use >= limit THEN
                RETURN TRUE
            ELSE
                RETURN FALSE
            END IF
        END IF

    END WHILE

    -- Shouldn't get there but in case we do
    RETURN FALSE

END FUNCTION    {license_exceeded}