brucewin
Posts: 143
|
| Posted: 04/21/2006, 7:36 PM |
|
Trying to get a field value to place in all records on a grid from a logged in users userid. Something tells me I don't have the code right. It doesn't work.
CCDLookUp(user_message,usertable, user_id=CCGetSession(UserID),Intranet)
Any help would be appreciated.
|
 |
 |
Damian Hupfeld
|
| Posted: 04/21/2006, 10:45 PM |
|
You may be missing a few "" or ''....
View the examples in the help...
"brucewin" <brucewin@forum.codecharge> wrote in message
news:5444996acb52ee@news.codecharge.com...
> Trying to get a field value to place in all records on a grid from a
> logged in
> users userid. Something tells me I don't have the code right. It doesn't
> work.
>
>
> CCDLookUp(user_message,usertable, user_id=CCGetSession(UserID),Intranet)
>
> Any help would be appreciated.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 04/23/2006, 5:49 PM |
|
CCDLookUp("user_message", "usertable", "user_id=".CCGetUserID(),$DBIntranet)
$DBIntranet if your connection is named Intranet.
Check it in Project Settings->Connections
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
brucewin
Posts: 143
|
| Posted: 04/24/2006, 5:11 AM |
|
Thanks, for the respones, I tried the above and it just returns the key e.g. text6. I am putting the code in the default for the field in the data section of properties.
|
 |
 |
WKempees
|
| Posted: 04/24/2006, 2:40 PM |
|
"The above" was merelyu a syntax correction upon the statement you posted.
Conclusion: you statement wasn't the right one., but "the above" does work.
The rest of your text I don't understand.
"brucewin" <brucewin@forum.codecharge> schreef in bericht
news:5444cc068543db@news.codecharge.com...
> Thanks, for the respones, I tried the above and it just returns the key
> e.g.
> text6. I am putting the code in the default for the field in the data
> section
> of properties.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
brucewin
Posts: 143
|
| Posted: 04/24/2006, 3:06 PM |
|
That being said, in order for me to use the CCDLookUp function to get the user_message for the logged in user from the user_table with the connection name,UserConnection , what should the code look like?
field: user_message
table: user_table
where_clause?
connection: UserConnection
Bruce
|
 |
 |
Damian Hupfeld
|
| Posted: 04/24/2006, 4:41 PM |
|
try something like:
$Label1->SetValue(CCDLookUp("user_message", "usertable",
"user_id=".CCGetUserID(),$DBIntranet));
Damian
"brucewin" <brucewin@forum.codecharge> wrote in message
news:5444d4bcc39620@news.codecharge.com...
> That being said, in order for me to use the CCDLookUp function to get
> the
> user_message for the logged in user from the user_table with the
> connection
> name,UserConnection , what should the code look like?
>
>
> field: user_message
> table: user_table
> where_clause?
> connection: UserConnection
>
> Bruce
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
brucewin
Posts: 143
|
| Posted: 04/25/2006, 4:19 AM |
|
still can't get it to work. can the table for the grid be the same as the logged in user table? could I be doing something wrong in properties? thanks for all your help. Bruce
|
 |
 |
WKempees
|
| Posted: 04/25/2006, 9:08 AM |
|
Where are you putting this code?
what does this do:
global $DBIntranet();
$Label1->SetValue(CCDLookUp("user_message", "usertable",
"user_id=".CCGetUserID(),$DBIntranet));
echo "The value of Label1 is " . $Label1;
echo "<br> The userid is : ". CCGetUserID();
"Damian Hupfeld" <damian.hupfeld@itng.com.au> schreef in bericht
news:e2jnns$ffl$1@news.codecharge.com...
> try something like:
>
> $Label1->SetValue(CCDLookUp("user_message", "usertable",
> "user_id=".CCGetUserID(),$DBIntranet));
>
> Damian
>
>
> "brucewin" <brucewin@forum.codecharge> wrote in message
> news:5444d4bcc39620@news.codecharge.com...
>> That being said, in order for me to use the CCDLookUp function to get
>> the
>> user_message for the logged in user from the user_table with the
>> connection
>> name,UserConnection , what should the code look like?
>>
>>
>> field: user_message
>> table: user_table
>> where_clause?
>> connection: UserConnection
>>
>> Bruce
>>
>>
>> ---------------------------------------
>> Sent from YesSoftware forum
>> http://forums.codecharge.com/
>>
>
>
|
|
|
 |
brucewin
Posts: 143
|
| Posted: 04/25/2006, 3:06 PM |
|
I am putting the code in the before show event for Label1 on my grid.
|
 |
 |
WKempees
|
| Posted: 04/25/2006, 5:23 PM |
|
That's the answer to question 1.
What is the answer to question 2 ??
Quote :
what does this do:
global $DBIntranet();
$Label1->SetValue(CCDLookUp("user_message", "usertable",
"user_id=".CCGetUserID(),$DBIntranet));
echo "The value of Label1 is " . $Label1;
echo "<br> The userid is : ". CCGetUserID();
"brucewin" <brucewin@forum.codecharge> schreef in bericht
news:5444e9d783787e@news.codecharge.com...
> I am putting the code in the before show event for Label1 on my grid.
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
WKempees
|
| Posted: 04/25/2006, 5:55 PM |
|
If you are in the BeforeShow of Label1 in a grid
AND CCS3+
AND Label1 was created by you by picking it from the Form Tab of the toolbox
(not the HTML tools)
global $DBIntranet();
$Component->SetValue( CCDLookUp("user_message", "usertable",
"user_id=".CCGetUserID(),$DBIntranet) );
OR
global $DBIntranet();
$Container->Label1->SetValue( CCDLookUp("user_message", "usertable",
"user_id=".CCGetUserID(),$DBIntranet) );
OR BEST SOLUTION OF ALL
none of the above
simply put a Form Label in the grid, select it, in the properties BeforeShow
add the "DLookup" action
and set the properties:
Expression: "user_message"
Domain: "usertable"
Criteria: "user_id=".CCGetUserID()
Connection: Pick it from the list
Convert result to: Text
Type of target: Control
Target: Label1
Does it end here?
|
|
|
 |
brucewin
Posts: 143
|
| Posted: 04/25/2006, 6:29 PM |
|
Thanks, for all of the input, I'll will try all of the proposed solutions. Appreciated Bruce
p.s. Someday I will be able to repay you guys with answers to your questions.
|
 |
 |
brucewin
Posts: 143
|
| Posted: 04/25/2006, 6:42 PM |
|
I skipped right to the Best Solution of All! It worked perfectly. Truely AMAZING!!!,I don't know how or why that worked by it did.
I owe you again.
The End
Bruce       
|
 |
 |
WKempees
|
| Posted: 04/25/2006, 6:56 PM |
|
With a BIG smile: RTFM
"brucewin" <brucewin@forum.codecharge> schreef in bericht
news:5444ed01828df4@news.codecharge.com...
>I skipped right to the Best Solution of All! It worked perfectly. Truely
> AMAZING!!!,I don't know how or why that worked by it did.
>
> I owe you again.
>
> The End
>
> Bruce        
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |
chasferr
|
| Posted: 04/29/2006, 7:51 PM |
|
You could you amend it a bit. I am not using a UserID function. I am just using a field within the database. Could you give me the syntax.
connection is connection1
table is reator_unreg_homes
field is id
field source is id from a different table that I am querying with.
target is control named id3
Thanks for any response.
|
|
|
 |
Damian Hupfeld
|
| Posted: 05/01/2006, 6:05 AM |
|
read Walters post - change the values (read the documentation on the use of
CCDLookUp) and you wouldnt need to use the CCGetUserID() function.
Damian
"chasferr" <chasferr@forum.codecharge> wrote in message
news:54454263d375b7@news.codecharge.com...
> You could you amend it a bit. I am not using a UserID function. I am just
> using
> a field within the database. Could you give me the syntax.
>
> connection is connection1
> table is reator_unreg_homes
> field is id
> field source is id from a different table that I am querying with.
> target is control named id3
>
> Thanks for any response.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>
|
|
|
 |