Copy link to clipboard
Copied
First off, let me apologize for the cryptic title, but I wasn't sure what to call this thread.
I'm pulling a list of users from a web service that I'm integrating into an application that I'm modernizing. Previous versions of this app stored users in a table, whereas now they're being pulled from a web service. Certain users are assigned certain tasks, so I have a table in the database that matches user IDs with task IDs.
Right now, I've pulled the user data from the web service into a new query, using QueryNew() and its siblings. But now that I have my hands on that data, I've realized that I can't use it.
In the past, I've done inner joins do things like list users with their tasks, assign tasks, etc. I've done this using JOINS in my queries. But now I can't figure out how I'm going to duplicate this using external data.
One idea I have is to do an INSERT into a users table in the database as soon as the application is loaded into a browser. If I wrap a try/catch block around the query, I won't have to worry about errors on existing IDs. Then I can use my old code as-is.
But is there a better way?
I would store the in-coming user data in a user table in my own database. I would design its columns, keys, etc. such as to make it fit with the other tables in my data model.
Copy link to clipboard
Copied
It is unclear whether the database containing users and tasks is yours, or even whether you have access to it. It is also unclear why you say, "now that I have my hands on that data, I've realized that I can't use it.".
Copy link to clipboard
Copied
Sorry! I have an MSSQL database that contains the tasks and other related data for this app. I have complete control over that database. It used to contain a list of my users.
My list of users is now coming from a web service, so I have to try to figure out how to work with that data (the data I now "have my hands on"). It's easy to display, but not so easy to incorporate into my app.
In past incarnations of this app, the users table was joined to the tasks table, so I could do things like show which users had which tasks assigned, along with the level of completion of each task. Now the users are in a struct that I created using QueryNew(), so I have to figure out how to work with that data.
Hope that makes sense!
Copy link to clipboard
Copied
I would store the in-coming user data in a user table in my own database. I would design its columns, keys, etc. such as to make it fit with the other tables in my data model.
Copy link to clipboard
Copied
Yeah, I think that's probably the best idea. I just wrote a CFC that does it, and I can invoke that from wherever I need it.
Thanks!