Using GenerateGeodatabaseParameters's layerQueries property in qml

6665
17
Jump to solution
03-25-2016 09:00 AM
tanerkoka1
Occasional Contributor

Hi,

I want to filter data from specific service layer when generating a local geodatabase, when I use long query generating a local geodatabase gives an error.I also query the same query in rest api in web, when I make query with Query (GET) buton also show nothing in rest but when I make query with Query (POST)  give correct result.How can I filer correct with layerQueries  and generating a local geodatabase without error.

Thanks.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
AnthonyKobah
Occasional Contributor

taner koka

You might have to set Standardized Queries to False if its failing to generate the database as a result of the WHERE clause.

By default, standardized Queries are set to true. Be mindful doing so will make your database more vulnerable to SQL injections. Please see the link below.

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

View solution in original post

0 Kudos
17 Replies
LucasDanzinger
Esri Frequent Contributor

What is the error? You should be able to specify a WHERE clause when generating your local geodatabase in the parameters.

0 Kudos
tanerkoka1
Occasional Contributor

The error is when I generate geodatabase in GeodatabaseSyncTask in onGeodatabaseSyncStatusInfoChanged signal in geodatabaseSyncStatusInfo.statusString gives "Failed" status string info message.

I'm also specify WHERE clause when generating my local geodatabase in the parameters.When I use long query in paramater local geodatabase gives tahat error when I generate .

Thanks

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Can you use Fiddler and set up a proxy so that you can see if the http requests are returning any more detailed errors? ArcGIS Runtime SDK for Qt QML API: ArcGISRuntime Class Reference

What is an example of the long query you are using?

0 Kudos
tanerkoka1
Occasional Contributor

Here is the long query below:

   property var layerQueryList:[]

  LayerQuery

{

id:layerQuery

}

        Button {

            id: generateButton

            text: "Generate Geodatabase"

            enabled: false

            style: ButtonStyle {

                label: Text {

                    text: control.text

                    color: control.enabled ? "black" : "grey"

                    horizontalAlignment: Text.AlignHCenter

                }

            }

            onClicked:

            {

                generateGeodatabaseParameters.initialize(serviceInfoTask.featureServiceInfo);

                generateGeodatabaseParameters.extent = mainMap.extent;

                generateGeodatabaseParameters.layerIds=[1,2,5,6,17,18,19];

                layerQuery.layerId=17;

                layerQuery.includeRelatedFeatures=true;

                layerQuery.queryOption=Enums.QueryOptionUseFilter;

                layerQuery.useGeometry=false;

                 layerQuery.where="ID IN ('{BC768705-54F7-4040-8042-F42B66B72E9E}','{0D5A8097-7DB3-4049-A1D1-873460839496}','{E340CEB5-5A5F-4FCA-9F4F-836DA15EE25F}','{BC768705-54F7-4040-8042-F42B66B72E9E}','{E8A6ABB6-F478-4E96-B0DA-0694C0620BB4}','{A48FED7E-E2F7-4F9C-B0B1-D7F88334A596}','{E5521C3B-EA5C-4F74-B991-6786BE41A242}','{E340CEB5-5A5F-4FCA-9F4F-836DA15EE25F}','{583CFEF1-BD0D-4098-8422-E56AFE98FADF}','{2A70019D-D5CC-4C51-9458-0897AFD894A7}','{1330C3FB-3398-4E54-9229-BD2F4225F0D5}','{B4C69CF0-C545-4239-9CFA-2FEE291A0E4F}','{408BE8A9-120E-4B94-8798-28E5E6E8F2FC}','{5A4369FE-AD50-4814-8B99-CC89ACEC4649}','{BC1F1F27-A732-4782-A281-380055689D64}','{BC1F1F27-A732-4782-A281-380055689D64}','{9938A5AD-AB0C-4FF4-BEF7-2DFB55781223}','{D66DB646-2668-492D-9937-3CBA90DA5253}','{C3BC2D70-32EB-49F0-95D1-7EF98AA98165}','{9938A5AD-AB0C-4FF4-BEF7-2DFB55781223}','{A1110593-B5F4-4639-A95E-EB3AE8A628A5}','{D3487675-79B7-4BF4-BBB1-D90D11552A93}','{F06F2DF6-B9C5-4A73-80D7-5822261BA6E8}','{D3487675-79B7-4BF4-BBB1-D90D11552A93}','{3C64831B-6829-4FA9-99F7-4674C9BA3A78}','{1D336969-D342-44A9-B2A6-47FDD937372A}','{3C54BA79-A559-460F-914F-E6CC680ED264}','{D3487675-79B7-4BF4-BBB1-D90D11552A93}','{B4C69CF0-C545-4239-9CFA-2FEE291A0E4F}','{BC1F1F27-A732-4782-A281-380055689D64}','{C93E0F15-0DA2-42D7-9D6B-02AB7DFA4257}','{D85870A6-7004-44EE-8393-DB56D62CEF95}','{9938A5AD-AB0C-4FF4-BEF7-2DFB55781223}','{90ACE8D9-F673-4141-B784-E05061921998}')"

                layerQueryList.push(layerQuery);

                generateGeodatabaseParameters.layerQueries=layerQueryList;

                generateGeodatabaseParameters.returnAttachments = false;

                statusText.text = "Starting generate geodatabase task";

                geodatabaseSyncTask.generateGeodatabase(generateGeodatabaseParameters, gdbPath);

            }

        }

0 Kudos
LucasDanzinger
Esri Frequent Contributor

You should be able to go to the REST page of the service and click "Create Replica", and specify all of this info there. Does it work from the REST page? This is what you need to determine first, because if not, it will not work in a client API. If it does not work, then it either is a limitation with or a bug in ArcGIS Server.

0 Kudos
tanerkoka1
Occasional Contributor

Hi Lucas ,

I'm specify all same  info like above in REST page of the service and I'm creating replica .The Rest page of service replica result is correct and returns  correctly records .Here is the REST Replica example belowin picture.How can I filter correct with layerQueries and generating a local geodatabase witout error in QML API ?

CreateReplica.png

0 Kudos
LucasDanzinger
Esri Frequent Contributor

My recommendation is to either contact Esri support to have them help you troubleshoot this, or to use Fiddler (or some other web debugging utility) to monitor the http traffic. I would compare the requests and responses when using the Runtime API and when just using the REST page to see if you can narrow down where the issue is, based on any differences that I see in the http requests.

0 Kudos
tanerkoka1
Occasional Contributor

Lucas,

I'm using one of web debugging utility during generate my local geodatabase and I'm  monitor the http traffic,the  result query is with GET metod .In my opinion if I editing my query with POST method I can solve this long query problem .How can editing my codes with POST method from QML API? Can you help about this ?

Thanks

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Hmm, I wonder if you can try the following - ArcGISRuntime.doPost = true;

RuntimeQtSamples/main.qml at master · ldanzinger/RuntimeQtSamples · GitHub

0 Kudos