I was thinking that I had to do it through validation. Like: validate input against class function spit out scenario follow-on action triggers call to DAL with a look-up function trigger output view that takes ID from row in the table and passes relevant data to the view
but so far I can't figure it out. looks like something to do with crud.settings.create_onvalidation:StorageList() for the validation part. am I on the right track there? On Feb 28, 10:13 am, Massimo Di Pierro <massimo.dipie...@gmail.com> wrote: > session.my_input_data = <anything pickleable> > > Not quite. Anything pickable built out of list, dict, tuples, int, > float, bool. Not instances of classes defined in modules. Even if > web2py can pickle it and store it, it may not be able to retrieve it. > > On Feb 28, 8:36 am, Alan Etkin <spame...@gmail.com> wrote: > > > > > > > > > I assume you are using web2py to expose the form. Have you? > > > If so, any data pickleable processed from the input can be stored and > > retrieved with de session object, which is available at any > > controller, model or view with each action: > > > # store my input data > > session.my_input_data = <anything pickleable> > > > # show my input data in a view > > {{ =H3("My input data") }} > > {{ =session.my_input_data }} > > > On Feb 28, 10:16 am, Sam Flynn <flynns.arcade2...@gmail.com> wrote: > > > > I'm trying to do a step process with data and having difficulty > > > figuring it out. Any help MUCH appreciated! > > > > I want to use a standard form such as input_form.html. The input > > > values will be for values of w, x, y, z (e.g. W: > > > <input name="w" />). From there I want to send the input values to > > > the following function to be classified: > > > > class Scenario(object): > > > def __init__(self, w, x, y, z): > > > self.val = {} > > > self.val['w'] = self.value(w,10,50) > > > self.val['x'] = self.value(x,5,15) > > > self.val['y'] = self.value(y,25,75) > > > self.val['z'] = self.value(z,3,7) > > > def value(self, v, l, u): > > > if (v < l): > > > return "low" > > > if (u > v >= l ): > > > return "med" > > > if (v >= u): > > > return "high" > > > def __str__(self): > > > return "scenario = (w: " + self.val['w'] + " x: " + self.val['x'] > > > + " y: " + self.val['y'] + " z: " + self.val['z'] + ")" > > > > This will return a scenario = w: w, x: x, y: y, z: z. > > > > I'm looking to then match that scenario value against a table of the > > > 80 possible scenarios and retrieve an output for the matching scenario > > > in the table. The output I would send back to the 'next' page from > > > the form along with a print of the scenario in question. > > > > Again, any help on this greatly appreciated. Once I see it once I'll > > > be able to get it.