Must probably because I dont know! :( Let me give it a try what you just
posted and will write back. Thanks!
On Thursday, July 11, 2013 1:58:10 PM UTC-7, Richard wrote:
>
> So you don't want to reference the series and supplier... So, I think that
> your model should be better in this case if your field were of type
> 'string', since you control the contain of the dropbox with requires anyway.
>
> That said... What I still don't understand is that you just seems to want
> the "representation" of the id of the record not a concat compute or your
> lambda are wrong because you don't know how to acheive it.
>
> For instance it easy to compute a contatation from different selected id
> of reference table like this :
>
> model
>
> db.define_table('table',
> Field('f1', 'reference table1'),
> Field('f2', 'reference table2'),
> Field('compute_field', 'string', compute=lambda row: '%s - %s' %
> (db.table1(row.f1).represent_field, db.table2(row.f2).represent_field))
>
> Richard
>
>
> On Thu, Jul 11, 2013 at 4:45 PM, greenpoise <[email protected]<javascript:>
> > wrote:
>
>> haa..Its an odd model I know. But it works!! punch it in in a blank
>> project and you will see..
>> With my model I am trying to:
>>
>> 1. Concatenate the fields I just mentioned
>> 2. I want to compute the supplier code for products so I dont have to
>> add/select it in over and over.
>> 3. I want to export the final output (reason why I need the concatenate
>> in a compute).
>>
>> Once I export that in CSV, I can bulk upload that worksheet into RMS
>> (microsoft)..thats the whole reason behind this application and its weird
>> model.
>> If you can think of a better idea, I am open for input
>>
>>
>> Thanks again!!
>>
>> On Thursday, July 11, 2013 1:39:10 PM UTC-7, Richard wrote:
>>
>>> Hmmm... I think your model is wrong...
>>>
>>> You can't use a compute on a reference field..
>>>
>>> What you are trying to do exactly?
>>>
>>> Why you need to concatenate thing? For representation purpose?
>>>
>>> I think I really can help you what you need is easy but I can't
>>> understand your goal from the model you posted...
>>>
>>> Richard
>>>
>>>
>>> On Thu, Jul 11, 2013 at 4:12 PM, greenpoise <[email protected]>wrote:
>>>
>>>> Ok..I started playing around with an empty and smaller database for the
>>>> sake of speed. This is what I have:
>>>>
>>>> db.define_table('supplier',
>>>> Field('suppliercode'),
>>>> Field('suppliername'),
>>>> format='%(suppliercode)s')
>>>> db.supplier.suppliercode.**requires = IS_NOT_IN_DB(db,db.supplier.**
>>>> suppliercode)
>>>> db.supplier.suppliername.**requires = IS_NOT_IN_DB(db,db.supplier.**
>>>> suppliername)
>>>>
>>>> db.define_table('series',
>>>> Field('supplier','reference supplier'),
>>>> Field('seriesname'),
>>>> Field('seriesdescription'))
>>>> db.series.supplier.requires = IS_IN_DB(db,db.supplier.id,'%(**
>>>> suppliername)s')
>>>>
>>>> db.define_table('product',
>>>> Field('series', 'reference series'),
>>>> Field('supplier', 'reference series',compute=lambda row:
>>>> db.series(row.series).**supplier),
>>>> Field('supptile', 'reference supplier',compute=lambda row:
>>>> db.series(row.series).**supplier),
>>>> Field('tilename'))
>>>> db.product.series.requires =
>>>> IS_EMPTY_OR(IS_IN_DB(db,db.**series.id<http://db.series.id>
>>>> ,'%(seriesname)s'))
>>>>
>>>> I want to concatenate/compute db.product.supptile with
>>>> db.product.tilename ..Is is possible?? .
>>>>
>>>>
>>>>
>>>>
>>>> On Thursday, July 11, 2013 11:50:07 AM UTC-7, Anthony wrote:
>>>>>
>>>>> Oops, sorry, I read that wrong -- thought it was a "represent"
>>>>> function rather than a "compute" function. Yes, not sure you want to
>>>>> store
>>>>> a value other than the db.series.id value in a reference field for
>>>>> db.series.
>>>>>
>>>>> Anthony
>>>>>
>>>>> On Thursday, July 11, 2013 2:39:39 PM UTC-4, Richard wrote:
>>>>>>
>>>>>> But in this case you don't have the id of the referenced record as
>>>>>> relation key... I am not sure it's what you want. But you question is
>>>>>> really vague so difficult to answer correctly to your I think :P
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>> On Thu, Jul 11, 2013 at 2:21 PM, Anthony <[email protected]> wrote:
>>>>>>
>>>>>>> On Thursday, July 11, 2013 1:21:11 PM UTC-4, greenpoise wrote:
>>>>>>>
>>>>>>>> I think I saw some light in here! this did the trick for me:
>>>>>>>>
>>>>>>>> Field('supplier', 'reference supplier',compute=lambda row: db.
>>>>>>>> series(row.series).supplier******),
>>>>>>>>
>>>>>>>
>>>>>>> Should be the same as:
>>>>>>>
>>>>>>> lambda row: row.series.supplier
>>>>>>>
>>>>>>> assuming row.series is a reference field referring to db.series.
>>>>>>>
>>>>>>> Anthony
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "web2py-users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> For more options, visit
>>>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
>>>>>>> .
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+un...@**googlegroups.com.
>>>> For more options, visit
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>>
>>>>
>>>
>>> --
>>
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.