LiveCloud Forums
cdb_User List - Printable Version

+- LiveCloud Forums (https://forums.livecloud.io)
+-- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=1)
+--- Forum: General (https://forums.livecloud.io/forumdisplay.php?fid=3)
+--- Thread: cdb_User List (/showthread.php?tid=56)



cdb_User List - clarencemartin - 07-18-2019

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?


RE: cdb_User List - jasonchan - 07-18-2019

Can you clarify how you are using this list to update or delete a user?


RE: cdb_User List - clarencemartin - 07-18-2019

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 ".?" .


RE: cdb_User List - jasonchan - 07-18-2019

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


RE: cdb_User List - clarencemartin - 07-22-2019

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.


RE: cdb_User List - efrain.c - 07-22-2019

(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.


RE: cdb_User List - clarencemartin - 07-23-2019

(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!