[OGo-Developer] accessing telephone numbers of team members in
OGOGroupsPage
Adam Tauno Williams
developer@opengroupware.org
Tue, 06 Mar 2007 07:06:00 -0500
> > On Mar 6, 2007, at 10:58, Sebastian Reitenbach wrote:
> > > /* fetch members */
> > > members = [cmdctx runCommand:@"team::members",
> > > @"teams", self->groupList,
> > > @"returnType", intObj(LSDBReturnType_ManyObjects),
> > > nil];
> > > NSLog(@"The team members telephones: %@", telephones);
> > Sebastian, sorry, but please do the obvious and get and read a C
> > tutorial. Then read the Objective-C book. This is really 101 stuff.
> I did read a lot of tutorials, e-books, ... available on objective C, gnustep,
> ...
> but it is a bit cumbersome, as some of the tutorials are working with
> libFoundation, some
> only with gnustep-base... inbetween I have no time to practice, and maybe
> forget...
It is confusing, but primarily because of the pile of new terminology.
There seems to be few differences between GNUstep and libFoundation.
Objective-C is actually really nice one you get a little used to it, and
accustom yourself to the wacky square-bracket syntax.
> besides that, on the gnustep list I have read that libFoundation and
> gnustep-base will be merged. At least I know that sope and ogo compiles
> with gnustep-base instead of libFoundation
I think for the application-level developer libFoundation/GNUstep issue
is irrelevant. libFoundation just implements the base classes.
> > members = [cmdctx runCommand:@"team::members",
> > @"teams", self->groupList,
> > @"returnType", intObj(LSDBReturnType_ManyObjects),
> > nil];
> > for (int i = 0; i < [members count]; i++) {
> > NSLog(@"member: %@", [members objectAtIndex:i]);
> >
> > NSArray *tels = [[members objectAtIndex:i]
> > valueForKey:@"telephones"];
> > for (int j = 0; j < [tels count]; j++)
> > NSLog(@" tel: %@", [tels objectAtIndex:j]);
> > }
> I was not aware that telephones will be accessible this way, but it looks very
> promising, I will test in the evening.
It is. The -
LSRunCommandV(_context, @"person", @"get-telephones",
@"objects", m,
@"relationKey", @"telephones", nil);
- command adds them to the person records under the telephones key.
EOGenericRecords are mutable, which, at first, was a mental hurdle for
me as well.
Each phone record has the following keys: telephoneId , companyId, info,
number, realNumber, type, and url.
> > Of course you need no code at all when you do this using
> > WORepetition's as I initially suggested.