Erlang/OTP Forums

Author Message

<  Erlyweb mailing list  ~  change from [value,..] to [{fieldname,value},..]?

Guest
Posted: Wed Jul 30, 2008 2:41 pm Reply with quote
Guest
Am I missing a function somewhere to change the resulting array of
module:find(..) from [value, ... ] to something like [{fielname,
value}, ... ] like is used to set a new entry?

regards, Ruud
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post received from mailinglist
Guest
Posted: Wed Jul 30, 2008 5:41 pm Reply with quote
Guest
No, there is no such function. You could do it as follows:

Values = [{Field, module:Field(Rec)} || Field <-
module:db_field_names(), Rec <- module:find()]

On Wed, Jul 30, 2008 at 7:28 AM, Ruud <ruud.prein@gmail.com> wrote:
>
> Am I missing a function somewhere to change the resulting array of
> module:find(..) from [value, ... ] to something like [{fielname,
> value}, ... ] like is used to set a new entry?
>
> regards, Ruud
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post received from mailinglist
Guest
Posted: Wed Jul 30, 2008 5:55 pm Reply with quote
Guest
note: this would work when find() returns just one result.

On Wed, Jul 30, 2008 at 10:41 AM, Yariv Sadan <yarivsadan@gmail.com> wrote:
> No, there is no such function. You could do it as follows:
>
> Values = [{Field, module:Field(Rec)} || Field <-
> module:db_field_names(), Rec <- module:find()]
>
> On Wed, Jul 30, 2008 at 7:28 AM, Ruud <ruud.prein@gmail.com> wrote:
>>
>> Am I missing a function somewhere to change the resulting array of
>> module:find(..) from [value, ... ] to something like [{fielname,
>> value}, ... ] like is used to set a new entry?
>>
>> regards, Ruud
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post received from mailinglist
Guest
Posted: Thu Jul 31, 2008 7:15 am Reply with quote
Guest
This could be done with find_first/3.
Thanx for the quick reply.

regards, Ruud

On Jul 30, 7:42

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum