• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
cdb_User List
#1
I want to create a list of cdb_Users.
I want to use this list to select a user to update or delete.
I have looked at the user api's and can't find the api that would let me create such a list.
Can I do this via a query and can you give an example script?
  Reply
#2
Can you clarify how you are using this list to update or delete a user?
  Reply
#3
I think that I have figured part of this out. I didn't understand about using the cdb_userTable to get the CDBUsersTable id. for the query.

the following script yields: only user recordID's

on mouseUp pButtonNumber
local tInputA, tOutputA, tUsers
put cdb_userTableName() into tUsers
put cdb_query("email","~","*.com",tUsers,"cloud","recordList") into tOutputA
answer tOutputA
end mouseUp

OK, I changed the "recordList" to "RecordData" and I see all of the Array data.

Jason,
creating a list of users will allow an Administrator to pick a user from a list that he/she wants to delete.
Deleting a user with the LCM is easy, but an administrator may want to delete a particular user via the application and having a list of users is the way to do this.

I am actually changing the following line in the script" to:
put cdb_query("email","~","*.*",tUsers,"cloud","recordList") into tOutputA.
the reason : there may be emails that are ".com", ".net" or any ".?" .
  Reply
#4
I think you can either do a batch read on all the records or just list the emails to choose from.

Doing this should give you all the data of the users table
local tInputA, tOutputA, tTableID
put cdb_userTableName() into tTableID
put empty into tInputA[tTableID]["*"]
put cdb_batchRead(tInputA,"cloud") into tOutputA

You can also use cdb_list to get a list of the emails and let the administrator choose from the emails.
local tTable, tTarget, tKeys, tOutputA
put cdb_userTableName() into tTable
put cdb_list(tTable,"cloud","email") into tOutputA
  Reply
#5
can you please test this script that you posted?

local tInputA, tOutputA, tTableID
put cdb_userTableName() into tTableID
put empty into tInputA[tTableID]["*"]
put cdb_batchRead(tInputA,"cloud") into tOutputA

I have been trying to make this work and this doesn't seem to work.
  Reply
#6
(07-22-2019, 03:14 AM)clarencemartin Wrote: can you please test this script that you posted?

local tInputA, tOutputA, tTableID
put cdb_userTableName() into tTableID
put empty into tInputA[tTableID]["*"]
put cdb_batchRead(tInputA,"cloud") into tOutputA

I have been trying to make this work and this doesn't seem to work.

Hi Clarence,

Can you try replacing

put cdb_userTableName() into tTableID

with

put cdb_tableID(cdb_userTableName()) into tTableID

This should fix your issue and give you an array with user records.
  Reply
#7
(07-22-2019, 11:17 PM)efrain.c Wrote:
(07-22-2019, 03:14 AM)clarencemartin Wrote: can you please test this script that you posted?

local tInputA, tOutputA, tTableID
put cdb_userTableName() into tTableID
put empty into tInputA[tTableID]["*"]
put cdb_batchRead(tInputA,"cloud") into tOutputA

I have been trying to make this work and this doesn't seem to work.

Hi Clarence,

Can you try replacing

put cdb_userTableName() into tTableID

with

put cdb_tableID(cdb_userTableName()) into tTableID

This should fix your issue and give you an array with user records.

Thank you. I'll give it a try and let you know.

Yes, it works!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)