How to insert data into two entities through a screen dailog in Lightswitch HTML client
-
Friday, December 21, 2012 12:48 PM
Hello,
I have two entities blob_assets and shared _resources. blob_assets contains image data and while shared_resources contain details about the information.
I set up a screen with both fields from shared_resources and an image uploader for blob_assets
When I add a button and call blob_assets.addAndEditNew only the ImageUpload control (browse) is enabled on the screen but the other controls for shared_resources are not enabled. How can I enable the controls and insert the records into the tables one after the other.
Tobi Akinseye
- Edited by toBbie Wednesday, January 02, 2013 2:44 PM
All Replies
-
Thursday, January 03, 2013 10:43 AM
I added a custom method to the button and wrote the following code. When I click the button the FIRST time, the fields for cm_wpc_sharedresources entity are enabled, and image uploader control for cm_wpc_blob assets is disabled. When I click the button the second time both fields for each entity become enabled. can anyone tell me why am having this behavior.myapp.CollaborationStream.SharePicture_Tap_execute = function (screen) { // Write code here. screen.cm_wpc_sharedresources.addNew(); screen.cm_wpc_blob_assets.addNew(); screen.showDialog("ImageUploader"); };
Tobi Akinseye
- Edited by toBbie Thursday, January 03, 2013 10:44 AM
-
Tuesday, January 08, 2013 5:38 PM
Hi toBbie,
What kind of relation do you have between the blob_assets and the sharedresources?
Heinrich
-
Wednesday, January 09, 2013 8:48 AM
There is no relationship defined between the two entites.
Only that blob_assets and shared resoures share a guid. When an image or document is to be inserted into blob assets, a guid is created and inserted into shared resources as well.
Tobi Akinseye
-
Monday, January 14, 2013 6:43 PM
Hi toBbie,
I tried to reproduce your issue. On my machine it actually worked fine. Can you tell me a bit more about your screen configuration?
Heinrich
-
Wednesday, January 16, 2013 1:04 PM
Here is my screen in VS and the screen in runtime.
The first three textboxes insert a record in shared_resources entity while the image uploader is to insert a record in blob_assets
Tobi Akinseye
-
Wednesday, January 16, 2013 9:05 PM
Hi toBbie,
Are you using the image uploader from our tutorial? Also what is the databinding of it in the properties sheet?
Heinrich
-
Thursday, January 17, 2013 9:32 AMYes I am.
This is the databinding of the image uploader: cm_wpc_blob_assets.selectedItem.image_data
Tobi Akinseye
-
Monday, January 21, 2013 6:29 PM
Hi toBbie,
This seems to be really hard to debug. Is there any way you can share your whole project?
Heinrich
-
Tuesday, January 22, 2013 11:09 AMThe project is using some tables in an already existing database. I'm not sure how to include only those tables in the project if I wanted to share it.
Tobi Akinseye
-
Wednesday, March 06, 2013 7:21 PM
Hi toBbie,
Can you try again with our new CTP4?
Heinrich

