cancel
Showing results for 
Search instead for 
Did you mean: 

Issue calling ds_generateMimeURL in SCN Community Component SDK

colin_terry
Explorer
0 Kudos

Hi,

I'm in the process of trying to enhance Mike Howles' SCN Community excellent Choropleth map component, so that it can upload and use a geoJSON file (functionality that currently exists in the Leaflet Map component).

I'm new to the development of the SCN Community components, however after a long and steep learning cure , I have finally got to the point where I have managed to upload a geoJSON file into the Design Studio repository - this was achieved through the use of the custom aps control "special-url", which I inserted into the code in VizMap.js as follows:

      function VizMap(options){

            var that = this;

            var properties = {

                  mapData : {

                        value : "",

                        opts : {

                    desc : "GeoJSON File",

                    cat : "Mapping-Map Data",

                    apsControl : "special-url",

                    kind: "GeoJSON"

                        },

                        onChange : function(value){

                              var file = value;

                              if(file){

                                    var url = "/aad/" + ds_generateMimeUrl(file);

                              }

                        }

                  },



However, I am now getting the following error message when trying to call the ds_generateMimeURL() function (which returns the full path to the file in the DS repository):


'A JavaScript error occurred. 'ds_generateMimeUrl' is undefined ReferenceError: 'ds_generateMimeUrl' is undefined    at properties.mapData.onChange (http://localhost:55016/aad/zen/mimes/sdk_include/org.scn.community.shared/os/viz-modules/VizMap.js?v...)    at Anonymous function (http://localhost:55016/aad/zen/mimes/sdk_include/org.scn.community.shared/os/viz-modules/SDKCore.js?...)    at updateProperty (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/component.js?version=201608031...)    at dispatchProperties (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/component.js?version=201608031...)    at dispatchProperties (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/sdkcontrol.js?version=20160803...)    at update (http://localhost:55016/aad/zen.res/zen.rt.components.sdk/resources/js/sdk_handler.js?version=2016080...)    at updateComponent (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=2016080312054...)    at dispatchUpdateControl (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=2016080312054...)    at dispatchDelta (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=2016080312054...)    at dispatch (http://localhost:55016/aad/zen.res/zen.rt.framework/resources/js/dispatcher.js?version=2016080312054...)'



This function call works just fine in the LeafletMap component (where the call to ds_generateMimeURL is invoked in the layereditor.js code).


I have checked that I am passing a valid file name (floor3.geojson) into the ds_generateMimeUrl() function, but I am obviously missing something fairly fundamental here.


I am hoping that someone can point me in the right direction as to what I am missing here, as I appear to have reached the limit of my expertise at the moment!


Additionally, I am finding it very difficult to find where the various function definitions are made within the various modules - am I missing something in my Eclipse Setup which will help me navigate the SCN Community code structure?


Kind Regards,


Colin

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member194504
Active Contributor
0 Kudos

Hi collin,

Can you tell me where the ds_generateMimeURL function resides in your code?

Thanks,

Nithyanandam

colin_terry
Explorer
0 Kudos

Hi Nithyanandam,


That's part of the problem - it's not a function I've written, but one that's already  in use by some of the other components in the SCN Community Components library.

I'm assuming that the component I'm attempting to modify hasn't included a relevant class library or something, but without any class documentation it's very hard to say..


In terms of how I'm using it, I am calling it from a modified version of Vizmap.js, which resides in the os\viz-modules folder of the 'Design Studio SCN Community Shared' project


regards,


Colin

former_member194504
Active Contributor
0 Kudos

Hi Collin,

As you were already aware, the file which have the generatemimeurl must be included in the dependency or you would be always facing the undefined issue.  It won't be hard to find, just go over the code using some search in editor for the function and give the file as dependency or just find the function copy it and paste it locally on your file to get it work. If you looking it only for a single component.

Thanks,

Nithyanandam