Hi there!
I'm building a job card app for a client.
I have a collection for Jobs and for JobTasks.
I'm trying to add a ToDo list (JobTasks) within a 'Jobs' object from the database. Every Job uploaded to the database has its own todo list. I've created a pointer from the Jobs Collection to the JobTasks Collection. How do I create a list unique to each Job Object?
Also, once the job is completed the user must upload photos (multiple) with a description of each photo. How do I link the specific files to the Job object? I know to use the Cordova Upload or the Camera Service but how do I point those files into the correct job object?
I hope what I'm asking makes sense.
How to connect a database object to a todo list and upload multiple files to a specific object?
-
Could someone maybe point me in the right direction to understand the database Pointer and how to use it? Maybe this is my biggest problem...
-
-
EMPLOYEE
1Hello,
>I'm trying to add a ToDo list (JobTasks) within a 'Jobs' object from the database. Every Job uploaded to the database has its own todo list. I've created a pointer from the Jobs Collection to the JobTasks Collection. How do I create a list unique to each Job Object?
If you created a collection JobTasks, which has a pointer (column) to the collection Jobs - you already have this list. For each job you can make a request by it's ID to see all tasks
>Also, once the job is completed the user must upload photos (multiple) with a description of each photo. How do I link the specific files to the Job object? I know to use the Cordova Upload or the Camera Service but how do I point those files into the correct job object?
The file upload service returns you the filename from the database. Please use this value to save the file for the specific object. -
-
Okay I was putting the pointer column in the Jobs collection and not the JobTasks. This makes much more sense, thanks!
Where the filenames are saved in the Jobs collection, what type of column will this be? There will be more than one filename...
Thanks for the quick response! -
-
How many files each job might have? If it is the only one - you can use a type=string for the filename. If more than 1 - please use an array of strings for them
- view 3 more comments
-
-
-
-
You just need to catch it on the success event and push the id to the array. When all ids will be caught - you can save that array to the database.
-
-
I came right thanks - I decided to upload the images to a new collection with a pointer.
-
-
-
-
>If you created a collection JobTasks, which has a pointer (column) to the collection Jobs - you already have this list. For each job you can make a request by it's ID to see all tasks.
How do I request this by getting the _id through mapping from storage?
replacing the "5c448c410f0d3168d78c38a4" with '' , or "Jobs_id" etc doesn't work? Whatever I try I get a query error. Do I need to Add JS to the input mapping? Sorry if this is too much.
-
-
Please add the JS code below to the mapping arrow:
return {"toJobs._id": value};
-
-
Do I add this to where?
I already have the param {"JobStatus":"New"}
How do I add two params? One that is set and one that is mapped from Storage? -
-
I added the databse script service List with the param 'where' with various values and mapping JS for {"$and":[{"JobStatus":"New"}, {"Username":"' +value+ '"}]} but I haven't gotten anything right.
So I tried using this server code script which worked perfectly when running the script with the script parameter "Username".
I'm struggling with invoking this service properly... I think I'm doing something wrong with the mapping or I'm missing a JS somewhere.
should i maybe try something in the lines of...:
console.log("value =" +value);
var whereObject= {Username: {"$inQuery": value}};
console.log("whereObject =" + JSON.stringify(whereObject));
return JSON.stringify(whereObject);
Please, any help on this would be appreciated! -
-
-
-
EMPLOYEE
1You are right, please use the Storage variable in the query if you need to use "$and" clause here.
1. Run it with a static value on the parameter "where" with the JS code:return {"$and":[...]};
2. Right after it is done - replace that static value with the value from your Storage variable -
-
-
-
Please share (https://docs.appery.io/docs/teams-sha...) your app with support@appery.io and provide us with the following information:
1) App name
2) Test credentials if login functionality is implemented in your app
3) Detailed steps to reproduce the issue -
-
It's working!
Somewhere along the way mapping of a previous service disappear and it wasn't storing the information I was trying to get.
Thank you so much for your help! -