Jump to content
  • 0

Automatic population with sample records at user sign-up


KG360
 Share

Question

When users sign up, I want them to get certain records in the app with their user ID so that the app is not empty everywhere and they can better understand how to use the app by viewing examples. 

I thought about creating a triggered action associated with the user table, so that when a user is approved / sign up the triggered action(s) provide the specified records. 

Before I start, I wanted to ask if anyone has any recommendations, as I anticipate it might be complicated. Several of the tables involved have referential integrity enabled and I suppose the population  must run a specific sequence.

Any experience, prior art,  ideas ?

KG

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

@KG360 I think your issue is similar to the one I faced building a demo environment where all data are cleaned and reloaded every 24h. 

First of all I believe that there isn't one solution for all scenarious. This because CASPIO cascading trigger limit. Your scenario may be influenced by table number and thei triggers.

What I did was:

1) create Task table - I have these fields because this ssolution can be used by more app in more tenants, but 
ID, Tenant, APP, Task, Status, Param_1 , Param_2, Param_3, Param_4, Param_5
But you cal limit to status and parameters fields
2) In your case you must put something, into some triggers of tables involved into signup process, to add a record into the task table with:
Status: Pending Param_1: userID
i.e. you could add this into an insert trigger of your user table.
3) built a scheduled Task that scan the task table for records with status Pending, read parameters, perform the initiaization operations you needand set Task status to OK.
I cloned this task in order to have one running every 15 min.

In your case I suggest to add a ready field into the user table with default NO. It should be set to YES by the task and could be checked to avoid logon until initialization rocess is completed. Let me know.

Link to comment
Share on other sites

  • 0
On 11/1/2022 at 9:29 AM, vidierre said:

@KG360 I think your issue is similar to the one I faced building a demo environment where all data are cleaned and reloaded every 24h. 

First of all I believe that there isn't one solution for all scenarious. This because CASPIO cascading trigger limit. Your scenario may be influenced by table number and thei triggers.

What I did was:

1) create Task table - I have these fields because this ssolution can be used by more app in more tenants, but 
ID, Tenant, APP, Task, Status, Param_1 , Param_2, Param_3, Param_4, Param_5
But you cal limit to status and parameters fields
2) In your case you must put something, into some triggers of tables involved into signup process, to add a record into the task table with:
Status: Pending Param_1: userID
i.e. you could add this into an insert trigger of your user table.
3) built a scheduled Task that scan the task table for records with status Pending, read parameters, perform the initiaization operations you needand set Task status to OK.
I cloned this task in order to have one running every 15 min.

In your case I suggest to add a ready field into the user table with default NO. It should be set to YES by the task and could be checked to avoid logon until initialization rocess is completed. Let me know.

Many thanks @vidierre! I agree that the limitations related to triggered actions make the tasks the most probable solution. I am trying to understand the solution you  outlined:

1. What is the role of the Task table, and what are you populating the fields with? What are the parameters? 

I will study your solution more in depth and try some scenarios. The records I want to provide to users are already in the target tables, as templates or admin records, and I simply need to copy then with the user id of the users who should be able to user the records as theirs and change the records anyway they want to. It's like a triggered action that duplicates records but assigned a new user ID. 

One potential hurdle is that most of the tables are connected via referential integrity enables relationships, but that should work provided the triggered are fired in the right sequence I would hope.

Regards/KG

 

Link to comment
Share on other sites

  • 0

hi @KG360, sorry I taken for granted the Task Table. Here are its fields meaning and how I use them:

  • ID - is the usual unique id field 
  • Tenant - it is a tenant identification. I use it because some apps are multitenant. You can omit this.
  • Task - Is the task to be performed. I have different tasks that can be performed. As example one task has to scan all records in a table and sen an email if a record mach some conditions. I use the task field intoo the scheduled task logic to perform differents scan on differents tables.
  • Status - It shows if that record (into my task table) has been perfomred or is yet to run. I set it to NO when I add a record into my task table, then into the scheduled task I scan all records with status=NO, execute the needed action and set status=OK to avoid double processing. If you want you can setup a second scheduled task that delete all records with status=OK
  • Param_1 .... Param_n - are parameters used by the scheduled task to perform different activities.

I hope it helps you. I understand that it is not the best clean solution, but I found nothing better for me,
If you like it please press the like button. If you have a best solution, please share it.

I wrote something similar to make an app log. you vìcan see it here

 

 

Link to comment
Share on other sites

  • 0
4 hours ago, vidierre said:

hi @KG360, sorry I taken for granted the Task Table. Here are its fields meaning and how I use them:

  • ID - is the usual unique id field 
  • Tenant - it is a tenant identification. I use it because some apps are multitenant. You can omit this.
  • Task - Is the task to be performed. I have different tasks that can be performed. As example one task has to scan all records in a table and sen an email if a record mach some conditions. I use the task field intoo the scheduled task logic to perform differents scan on differents tables.
  • Status - It shows if that record (into my task table) has been perfomred or is yet to run. I set it to NO when I add a record into my task table, then into the scheduled task I scan all records with status=NO, execute the needed action and set status=OK to avoid double processing. If you want you can setup a second scheduled task that delete all records with status=OK
  • Param_1 .... Param_n - are parameters used by the scheduled task to perform different activities.

I hope it helps you. I understand that it is not the best clean solution, but I found nothing better for me,
If you like it please press the like button. If you have a best solution, please share it.

I wrote something similar to make an app log. you vìcan see it here

 

 

Many thanks for the clarification.   I have started to implement something similar, using tasks...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...