Can I combine 2 quick report apps into a single app?

1497
6
08-30-2016 01:03 PM
AnkitPrahnani1
New Contributor III

I have made 2 quick report apps pertaining to 2 different surveys. Is there anyway I can join the 2 apps into one such that the user is given a choice of selecting which of the 2 surveys he wants to take inside a single app.

Once the user makes a selection then he should be directed to the WelcomePage.qml of one of the 2 apps.

qml‌

appstudio for desktop‌

#quick report

#welcomepage.qml

0 Kudos
6 Replies
nakulmanocha
Esri Regular Contributor

When the quickreport application loads the welcome page, one of thing it does is it initializes the feature service layer so that it has the necessary information  to load the following pages in the stackview. If you want you can have another page before the welcome page. Where you can select one layer from multiple feature service layers. Based  on the selection you can proceed with the normal quick report application. 

So the short answer is yes you can achieve this but you need to do some customization's so that end user can select layer before proceeding further. And you can design it how ever you want to do that. Just to be clear this is not available out of the box.

-Nakul

0 Kudos
AnkitPrahnani1
New Contributor III

Hi Nakul,

Thanks a lot for your help.

So I can just add an extra button to landingpage.qml of app1 that pushes the welcompage,qml of app 2 when clicked.

Also I think I will have to change the page names in app2 for avoiding conflicts. 

Can you suggest to me which pages should I copy for the second app to work and which pages I can omit?

One more question I have is which all parameters from app2 will I have to hard code?(For example I will have to hard code the link to feature class in app2 when I copy it to app1)

The resources that you advised me to peruse in my previous question have been very helpful. Thanks a lot for that!

Best!

Ankit 

0 Kudos
nakulmanocha
Esri Regular Contributor

Basically you need to override the featureServiceURL set in the appinfo.json properties page before it makes the call to this function

fetchFeatureServiceInfo();

This function gets called while the Landing page is being loaded. Hint:- Look at the QuickReportApp.qml to understand how the application initializes.
AnkitPrahnani1
New Contributor III

Hi Nakul Manocha ,

I tried to apply your advice and it is partially working. But I am stuck again and need your advice.

So what I did is that I created a new qml page (starting.qml) which opens before the landing page and has 2 icons. The user can choose either of the icons and based on his selection the FeatureLayerUrl is set and then the landingpage opens and things work perfectly.

MOVING ON TO THE ISSUE:

At the end of the stack (resultspage.qml) on pressing done the user is take back to the first page (starting.qml).

Now when I press the other button(which was not selected earlier) the add details page still shows the fields of the previous feature class.

I had made changes to the code that on pressing the button all the feature layer urls are changed and 

serviceInfoTask.fetchFeatureServiceInfo() is called.

HOWEVER
If I restart the app and press then press the second button then the feature fields work well.

I hope that you will be able to give me some guidance on this issue.

_______________________________________CHECK CODE BELOW_____________________________________

onSignInClicked1: {
                //serviceInfoTask.destroy()
                //serviceInfoTask()
                app.featureServiceInfoComplete = false
                app.featureServiceInfoErrored = false
                app.featureServiceURL = "url"
                app.featureLayerId = "0"
                app.featureLayerName = "layer1"
                app.featureLayerURL = featureServiceURL + "/" + featureLayerId
                theFeatureTypesModel.clear()
                theFeatureAttributesModel.clear()
                theFeatureAttributesVisualModel.clear()
                serviceInfoTask.fetchFeatureServiceInfo()
                app.isSmallScreen = (parent.width || parent.height) < 400*app.scaleFactor
                stackView.push(landingPage);
            }
            onSignInClicked2: {
                app.featureServiceInfoComplete = false
                app.featureServiceInfoErrored = false
                app.featureServiceURL = "url"
                app.featureLayerId = "0"
                app.featureLayerName = "layer2"
                app.featureLayerURL = featureServiceURL + "/" + featureLayerId
                theFeatureTypesModel.clear()
                theFeatureAttributesModel.clear()
                theFeatureAttributesVisualModel.clear()
                serviceInfoTask.fetchFeatureServiceInfo()
                app.isSmallScreen = (parent.width || parent.height) < 400*app.scaleFactor
                stackView.push(landingPage);
            }
0 Kudos
nakulmanocha
Esri Regular Contributor

I am not sure why it is doing. But you need to debug it to see if the featureServiceURL is correct when you select the second time and then compare the results with when you restart the app and then choose the same option. 

Also check with the AttributesPage.qml to see if ListView is getting reset. You may have to add few console.log statements or use the debugger to get to the bottom of this. 

AnkitPrahnani1
New Contributor III

Hi Nakul,

I tried the console statements and thinsg are really confusing.

Problem seems with the geodatabasefeatureservicetable.It does not seem to adapt to the new feature service url.

So even though the jumbled up fields of both feature services are visible, data only gets saved to the feature service which was selected first.

I have 4 questions for you:

1. Is there a way delete the geodatabasefeatureservicetable  when new feature class button is clicked?

2. If not, then is there a way to reset the entire App{} component when a button is pressed?

i.e. whenever we go back to the initial page where we choose the feature class the app gets reset?

3. Apart form serviceInfoTask.fetchFeatureServiceInfo() is it possible that I might need to call some other function too?

4. How can I reset ListView? I was not able to follow on this bit of advice. I think that this is important for getting correct add details page

Sorry for making this thread so long and asking so many questions. I hope I am not pestering you.

Best!

0 Kudos