Converting Classic L8 Inline to L9 & DS - Return Key Value?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting Classic L8 Inline to L9 & DS - Return Key Value?

Marc Pinnell-3
Working to convert some really old code. Inserting a new value into a table that uses an auto-increment key value. Stuck on how to get the key value (#innum in L8 code below).

Old L8 code (truncated a little for display):
        inline(
                $authInfo_db,
                #subDB, //override default db
                -table = 'subs',
                -add,
                -keyfield = 'innum',
                'cname' = #fromForm->find('fname')->first->second,
                'adcost' = #cost,
                'fld1' = 'WandW Subscription',
                'date' = date_format(date, -format='%D'),
                'time' = date_format(date, -format='%T')
                );
                #innum = field('innum'); //Pickup auto increment value
        /inline;

New L9 code using DS (truncated a little for display):
        subs_ds->keycolumn('innum') //innum is auto increment
                ->addrow(::subs,
                    map(
  ::cName = postparam('fname') + ' ' + postparam('lname'),
  ::address = postparam('sadd'),
  ::city = postparam('city'),
  ::time = date_format(date, -format='%T'),
  ::adcost = $cost,
  ::fld1 = 'WandW Subscription'
                    )
                    $innum = ::innum->asstring //Pickup auto increment value - doesn't work :(
                )

Is this possible? Do I need completely rethink the process (trying to convert, not reinvent!)

Marc

====================
Marc Pinnell
Director of Web Services
[hidden email]
www.shasta.com                                    
833 Mistletoe Lane, Suite A1
Redding, CA  96002
530-224-6866  Ext. 100
530-224-2035 Fax


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Converting Classic L8 Inline to L9 & DS - Return Key Value?

stevepiercy
$innum is nested within ->addrow.  That makes it a pair, not an
assignment, that you pass into ->addrow.

Try this:

     // attempt to add a new user and grab the record's keyvalue
     local(kv) = #create_record_ds
         -> addrow(
             ::column = value,
         ) -> keyvalue

--steve


On 7/24/16 at 11:22 AM, [hidden email] (Marc
Pinnell) pronounced:

>Working to convert some really old code. Inserting a new value
>into a table that uses an auto-increment key value. Stuck on
>how to get the key value (#innum in L8 code below).
>
>Old L8 code (truncated a little for display):
>inline(
>$authInfo_db,
>#subDB,         //override default db
>-table      =   'subs',
>-add,
>-keyfield   =   'innum',
>'cname'     =   #fromForm->find('fname')->first->second,
>'adcost'    =   #cost,
>'fld1'      =   'WandW Subscription',
>'date'      =   date_format(date, -format='%D'),
>'time'      =   date_format(date, -format='%T')
>);
>#innum = field('innum');        //Pickup auto increment value
>/inline;
>
>New L9 code using DS (truncated a little for display):
>subs_ds->keycolumn('innum')     //innum is auto increment
>->addrow(::subs,
>map(
>::cName     =   postparam('fname') + ' ' + postparam('lname'),
>::address   =   postparam('sadd'),
>::city      =   postparam('city'),
>::time      =   date_format(date, -format='%T'),
>::adcost    =   $cost,
>::fld1      =   'WandW Subscription'
>)
>$innum = ::innum->asstring  //Pickup auto increment value - doesn't work :(
>)
>
>Is this possible? Do I need completely rethink the process
>(trying to convert, not reinvent!)
>
>Marc
>
>====================
>Marc Pinnell
>Director of Web Services
>[hidden email]
>www.shasta.com                                     833
>Mistletoe Lane, Suite A1
>Redding, CA  96002
>530-224-6866  Ext. 100
>530-224-2035 Fax
>
>
>#############################################################
>
>This message is sent to you because you are subscribed to
>the mailing list Lasso [hidden email]
>Official list archives available at http://www.lassotalk.com
>To unsubscribe, E-mail to: <[hidden email]>
>Send administrative queries to  <[hidden email]>

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Steve Piercy              Website Builder              Soquel, CA
<[hidden email]>               <http://www.stevepiercy.com/>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Converting Classic L8 Inline to L9 & DS - Return Key Value?

Marc Pinnell-3
Brillant! Worked perfect.

Looking ahead, can you return other fields with the same technique?

marc


On Jul 24, 2016, at 11:33 AM, Steve Piercy - Website Builder <[hidden email]> wrote:

> $innum is nested within ->addrow.  That makes it a pair, not an assignment, that you pass into ->addrow.
>
> Try this:
>
>    // attempt to add a new user and grab the record's keyvalue
>    local(kv) = #create_record_ds
>        -> addrow(
>            ::column = value,
>        ) -> keyvalue
>
> --steve
>
>
> On 7/24/16 at 11:22 AM, [hidden email] (Marc Pinnell) pronounced:
>
>> Working to convert some really old code. Inserting a new value into a table that uses an auto-increment key value. Stuck on how to get the key value (#innum in L8 code below).
>>
>> Old L8 code (truncated a little for display):
>> inline(
>> $authInfo_db,
>> #subDB,         //override default db
>> -table      =   'subs',
>> -add,
>> -keyfield   =   'innum',
>> 'cname'     =   #fromForm->find('fname')->first->second,
>> 'adcost'    =   #cost,
>> 'fld1'      =   'WandW Subscription',
>> 'date'      =   date_format(date, -format='%D'),
>> 'time'      =   date_format(date, -format='%T')
>> );
>> #innum = field('innum');        //Pickup auto increment value
>> /inline;
>>
>> New L9 code using DS (truncated a little for display):
>> subs_ds->keycolumn('innum')     //innum is auto increment
>> ->addrow(::subs,
>> map(
>> ::cName     =   postparam('fname') + ' ' + postparam('lname'),
>> ::address   =   postparam('sadd'),
>> ::city      =   postparam('city'),
>> ::time      =   date_format(date, -format='%T'),
>> ::adcost    =   $cost,
>> ::fld1      =   'WandW Subscription'
>> )
>> $innum = ::innum->asstring  //Pickup auto increment value - doesn't work :(
>> )
>>
>> Is this possible? Do I need completely rethink the process (trying to convert, not reinvent!)
>>
>> Marc
>>
>> ====================
>> Marc Pinnell
>> Director of Web Services
>> [hidden email]
>> www.shasta.com                                     833 Mistletoe Lane, Suite A1
>> Redding, CA  96002
>> 530-224-6866  Ext. 100
>> 530-224-2035 Fax
>>
>>
>> #############################################################
>>
>> This message is sent to you because you are subscribed to
>> the mailing list Lasso [hidden email]
>> Official list archives available at http://www.lassotalk.com
>> To unsubscribe, E-mail to: <[hidden email]>
>> Send administrative queries to  <[hidden email]>
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> Steve Piercy              Website Builder              Soquel, CA
> <[hidden email]>               <http://www.stevepiercy.com/>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
> the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


====================
Marc Pinnell
Director of Web Services
[hidden email]
www.shasta.com                                    
833 Mistletoe Lane, Suite A1
Redding, CA  96002
530-224-6866  Ext. 100
530-224-2035 Fax


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>