Local Storage logic

Local Storage logic

  

I have two tables in local storage. One stores images that are taken in a form to LocalOut_Photos. 

The other table stores all other information for the form.

My question is, 

Since I am saving the images before saving the transactions how does the LocalOut_Photos get a LocalOut_Transaction Id?

Thanks

Andy

Hello Andrew,

In fact, you can't get a LocalOut_Transaction Id BEFORE creating it.
And your model tells me that you shouldn't be doing this, as the model says that every Transaction can have multiple Photos.

The normal way would be to save first the Transaction, get the Id and than starting save the Photos.

If, for some reason I don't know, you really needs to save photos first, the only way is to guarantee that LocalOut_TransactionsId have the Is Mandatory attribute set to False. 

Than, Save the Photos without it, and store the Id's of the Photos, so that after you create the LocalOut_Transaction record, you can update them.

But even in this case, if you can save at least a "skeleton" of the transaction, so you have an Id, would be better, because it is better update ONE transaction at the end, than MANY photos.

Why do you want to save Photos first?

Cheers,
Eduardo Jauch

I have three photos the user has to take, I want them to be able to view the images after it is taken in a first,second or third position.


I have the logic set up to save each photo in a local table with the photos position.  This allows me to show the photos in the correct position.  How would I go about updating the table with the id of the worksheet after the sheet is saved to local storage

First, you need a list or 3 local variables to store the id of the photos you save.

Than, after saving the worksheet, get each record of photos, with the ids you stored previously, and update the transaction id in them.

But I would save the transaction first, if you have all required date.

Cheers

Eduardo Jauch

How would I do that?

Save the record on initialize, store the id as a variable then run an update when i want to save again? 

Hi Andrew,

What exactly is this worksheet you mentioned?
Could you explain what is the "user story" here? Like, where it starts to get the 3 pictures and where it finishes?

Knowing this would be easier to provide you with a better solution :)

Cheers,
Eduardo Jauch

Sure

It is a field service app.  The end user selects a customer from list.  He has a choice of doing some things


The user then selects a vendor which filters the items by the vendor and presents only those items in the second dropdown. The Program button sets a different filter for the pull down.

The user then must take photos of the work completed.  They have the ability to take up to three. I have it set up that the user will see the image in the position over the button.  This way they will know what has already been done

To do this I save each photo when it is taken.  I then set up an aggregate to hold the photo, which is filtered by the photos location 

That's all I want to do, Show the images to the user.  This app will be used mostly off line with the units syncing at defined intervals.

Hope that helps


Andy

Ok, I don't know where the Transaction table fit in.

If you already have the information to create the Transaction record BEFORE the user take the pictures, I would say that you probably will want to create this record before taking the pictures, as the pictures have a FK to this table.

In this case, I would say the best place to create this record is when the user selects something that will take it to take the pictures.

BUT, 

If this is not true, if you don't have the information before taking the pictures, you do like this:

Change the FK in the pictures table to be NO mandatory (Is Mandatory = False), so you can save the pictures without a value to this attribute.

Later on, when you create the record in Transactions, you update the 3 pictures. Now, to update the 3 pictures, you need to know what are the pictures. So, or you have a way to filter the pictures aggregate by some information that is common to both tables, or you have to store the pictures id somewhere so that you can go get them at this point. Where will depends on your application, if it is being done in the same page can be local variables, if is in the next screen you will have to pass by input parameters, etc.

So, much more complex than having the the id of the transactions ready to save with the pictures.