JSON Date Source

Hello

I'm almost done to convert my application to use XML to JSON; the last thing I need to reconfigure is my field of research (which is looking the listView data source).

In XML, I would fix the query:

query: "/root/continent"

looking for this file:

XML


    
        
        Brazil vs Croatia
        Thursday 12 June 2014
        17:00PM (Local Time)
        Arena de Sao Paulo
        
    

So now, I have converted more of JSON and instead use the title of listItem, I use fixtureInfo just as they were both providing the same information.

JSON

[
  {
    "type":"item",
    "id":"1",
    "dateNumber":"12/06/2014",
    "fixtureInfo":"Brazil vs Croatia",
    "dateInfo":"Thursday 12 June 2014",
    "timeInfo":"17:00PM (Local Time)",
    "timestamp":"1402603200000",
    "stadiumInfo":"Arena de Sao Paulo"
  }
]

Data source:

DataSource {
                    id: dataSource1
                    property string sQuery: ""
                    onSQueryChanged: {
                        dataModel1.clear()
                        load()
                    }
                    source: "asset:///JSON/Fixtures.json"
                    type: DataSourceType.Json
                    remote: false

                    onDataLoaded: {
                        //create a temporary array tohold the data
                        var tempdata = new Array();
                        for (var i = 0; i < data.length; i ++) {

                            tempdata[i] = data[i]

                            //this is where we handle the search query
                            if (sQuery == "") {
                                //if no query is made, we load all the data
                                dataModel1.insert(tempdata[i])
                            } else {
                                //if the query matches any part of the country TITLE, we insert that into the list
                                //we use a regExp to compare the search query to the COUNTRY TITLE (case insenstive)
                                if (data[i].listItem.title.search(new RegExp(sQuery, "i")) != -1) {
                                    dataModel1.insert(tempdata[i])

                                    //Otherwise, we do nothingand donot insert the item
                                }

                            }

                        }

                        // this if statement below does the same as above,but handles the output if there is only one search result
                        if (tempdata[0] == undefined) {
                            tempdata = data

                            if (sQuery == "") {
                                dataModel1.insert(tempdata)
                            } else {
                                if (data.listItem.title.search(new RegExp(sQuery, "i")) != -1) {
                                    dataModel1.insert(tempdata)
                                }
                            }
                        }
                    }
                    onError: {
                        console.log(errorMessage)
                    }
                }

Therefore, what set that the query - for my data source - so that it will pick up the JSON data as before with XML?

Thanks in advance.

Like many I know THAT JSON does not use a query. Check out these https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/working_w... https://developer.BlackBerry.com/native/reference/Cascades/bb__data__jsondataaccess.html

Tags: BlackBerry Developers

Similar Questions

  • Web service JSON data do not return does not

    I created an application with a test sample local (active forlder) json file called "contacts.json" as below, just to test if I have any return data. The data returned in a listview without problem.

    [{ "id":1, "firstname": "Mike", "lastname": "Chepesky", "title": "Sr. Editor",
      "image": "images/data/mike_chepesky.png", "active": true, "gender": "m" },
    { "id":2, "firstname": "Westlee", "lastname": "Barichak", "title": "Talent Scout",
      "image": "images/data/westlee_barichak.png", "active": true, "gender": "m" }]
    

    I then changed the source for 'http://... '. "a link is valid and I checked, and it returns the data in a classic web browser (firefox). But he won't be in my application.

    What I noticed, is that the difference between the local json file and the return of web service, the web service does not return the square brackets "[...]" the json... I suspect that maybe that's the problem? If so, how do I manipulate the data source in my application to incorporate media? Is the returned data (without brackets) real...

    {"status":"successful","current_version":"1.1.1","latest_version":"1.2.0.0","details":"1. Item A 2. Item B 3. Item C","type":"Force update"}
    

    Thank you.

    If I'm not wrong, your local file json contains an array of objects, and that you load from your server contains a single object.
    If so, you can not call insertList (data), use insert (data)

  • Display images using URLS from a data source

    Hello!

    I have a source of JSON data with a URL pointing to the image. Basically, each record is a description of the dish and lead to URL of image with floor etc. plan...

    How much control should I use to view these images? I tried

    -IFrame, but it does not display the Referrer attribute.

    -Result: a list, but it can only attribute as a URL parameter. If I have {0} for full URL it does not display anything

    Basically, I want to refer to the IFrame URL attribute. It's an obvious thing and simplest

    Any ideas?

    Kirill

    Answer:

    Oracle® short Information Discovery Studio: Studio user's Guide

    Page 205

    3. use only one attribute for the full URL, but that data ingest processes encode any non structural

    parts of the URL, such as query string parameters.

    This prevents script injection and addresses all characters that are not allowed. When you enter the URL, you can then use the value of the attribute without encoding more far. For example:

    {{0}}

    0 is a number in the list of selected parameters.

  • DeserializeJSON - is there a limit on the size of the JSON data that can be converted?

    , I have a few valid JSON data which are converted successfully by DeserializeJSON... until it gets to a certain size, or is certainly what seems to be the case.  The breaking point seems to be somewhere in the neighborhood of 35 000 characters... about 35 KB.  When the conversion fails, it fails with a "JSON parsing failure: unexpected end of the JSON string" message.  And if the conversion fails, the JSON data are deemed to be valid by tools like this: http://www.freeformatter.com/json-validator.html.

    So, is there a limit on the size of JSON data can be converted by DeserializeJSON?

    Thank you!

    Thank you, Carl.

    The JSON is presented in its entirety, confirmed by Fiddler.  And it is in fact being recorded successfully to a SQL Server nvarchar field too.  I can validate that saved JSON.

    I'm actually grabbing the JSON to convert directly from SQL Server and your comments / ideas drove me on the path of resolution.

    It turns out that the JSON is truncated before going to the DeserializeJSON command, but it was the attraction of cfquery which was truncated.  The difficulty was to allow the 'long text retrieval (CLOB)"for this data source in CF Admin.  I would never forward or even knew that he had this setting.

    Thanks again for your comments!

  • How to bind the data source to a custom class?

    Hi all.

    I use the chart control to draw two types of plots. One is a path of spectrum which refreshes all samples in a short time, and the other is a curve of time series which add than one sample of each time.  A chartcollection was related to the data source, however, and draw the spectrum seems to not cool off very quickly. Was it due to the propertychanged event? In order to improve the speed of response, what should I do to deal with the data source?

    I went through your response and the help files and found I made a stupid mistake - I always used to Append method (double, double) and did not notice its format void Append (list, list).

    Thanks for your patient response, Paul :-)

  • create the SQL server programmatially data source

    Hello

    I would like to create a SQL server by programming in LabVIEW data source. The SQL server version that I used is from 2005. Can someone give some ideas? An example of code will be more favorable.

    Thank you

    Jane

    You can build the connection string you even.  The open function in the Toolbox of data base accepts a string as well (it's polymorphic) who can be the connection string.  This is the site I use to understand.  Is the most common things.  You may need to search Google more specific elements.

    http://www.ConnectionStrings.com/

    If you want to use the other option, someone has achieved a UDL editor in LabVIEW.  You can use this code to create your own UDL which can use the Open DB function:

    https://decibel.NI.com/content/docs/doc-18613

    I have used the above code, so can't comment on that.

  • Logging data source expressions

    Hello

    We use NI TestStand 2012 here in our society, and I have a simple question.

    In any test pass/fail (numeric, String, pass/fail regular), is it possible to have the TestStand to include the data source expression in the default report?

    I can add it manually in the component "Other results", but I have to do for each step.

    I see that on conditional expressions and flow measures are included in the report, but not the my expressions of pass/fail, which are found in the data source tab.

    It seems obvious to me that the data source should be there, otherwise I just in the report the name of the step and the result and no information of what has been actually tested.

    Thank you in advance!

    Leandro

    It does not show what the '10' value means: speed, voltage, current, RPM, etc. unless we call actually step in this way.

    Thanks again.

    There is a 'units' set numerical limit markets which addresses this problem. You can even specify custom units if you would like, although there are many built in those you choose as well. Also the name of the step should usually give an idea of what exactly is being tested.

    For the recording of Boolean expressions, probably the simplest thing is to use a stage model that is preconfigured to connect to the data source, or you can create a new custom step based on the test of success/failure that connects to the default data source type, or you could write a tool that passes through the sequence files and change all tests pass/fail to connect their datasource.

    -Doug

  • [Microsoft] [ODBC driver manager] Data Source name not found and no driver by default specified

    Hi team,

    I am trying to connect to the Oracle 9i database using VB code below:

    strConnection = "Driver = {Microsoft ODBC for Oracle};" Server = SERVERNAME; UID = username; Pwd = PASSWORD"
    Connect = New ADODB. Connection
    Connect.Open (strConnection)

    The last line throws me below error:

    [Microsoft] [ODBC driver manager] Data Source name not found and no driver by default specified

    The VB code works well and able to connect to database server dev dev. The same script with the name of the UAT server does not work on server UAT.

    The servers are Windows server 2007-32 bit.

    When I checked the tab drivers in ODBC Data Source Administrator, dev server entry below:

    Microsoft ODBC for Oracle - 6.00.6001.18000 - Microsoft Corporation - MSORCL32.dll - Date

    Considering that the UAT server has entered below:

    Microsoft ODBC for Oracle-

    The Microsoft ODBC driver for oracle is listed in the tab UAT Server drivers, but did not have details of file version & dll. This driver is not installed correctly? If so, how the re install? Please help solve this problem as soon as POSSIBLE.

    Kind regards

    Tamil

    This issue is beyond the scope of this site (for consumers) and to be sure, you get the best (and fastest) reply, we have to ask either on Technet (for IT Pro) or MSDN (for developers)
    *
  • Report Builder 1.0 will not connect to the data source for Reporting SERVICES

    We have a few users who are unable to connect to SSRS on SQL Server 2008 using the Report Builder version 1.0

    (We will be updating soon, but it's a slow process, and now users have questions)

    Instead of disputed for their IDs, they are requested to select a data source.  This information is supposed to be filled automatically when the user starts the Reporting SERVICES report designer.

    Does anyone know where/how SSRS communicates information to start the application with one click Report Builder, and where, if anywhere, it stores?

    Hello

    The following forum seems most appropriate for your question:

    https://social.msdn.Microsoft.com/forums/en-us/home?Forum=sqlreportingservices

    You can get a faster response there.

    I hope this helps.

    Kind regards

    Alberto Morillo
    SQLCoffee.com

  • SSRS for lack of outer join with the Oracle data source

    It seems to be a problem with the Oracle driver used in the Reporting SERVICES query designer.

    When you use an Oracle data source, if I create an outer join in the graphic designer, it automatically inserts '{OJ' before the join and '} ' after her.  This is an incorrect syntax for Oracle and refuses to start.  The curly braces and the JO editable in designer text, but if I go back to the graphic designer and immediately to reintegrate them.

    Only, this has started to happen a year or two ago - before that it worked, but with the old (+) syntax.

    Can it not be healed?  It makes things very difficult.

    -Geoff

    Hi Geoff,

    Thanks for posting in the Microsoft Community.

    However, the question you posted would be better suited in the Forums of the Oracle Support; We recommend that you post your query in Oracle Support Forums to get help:

    https://forums.Oracle.com/forums/main.jspa;JSESSIONID=8d92100c30d8fb401bcbd10b46c38c9ddf1a3242549a.e34SbxmSbNyKai0Lc3mPbhmSc3aNe0? CategoryID = 84

    If you have any other questions or you need Windows guru, do not hesitate to post your questions and we will be happy to help you.

  • How to draw 16 signals from a simple 8 channel 2 Data Sources file?

    Matrix is an hour + 8 channels from a data source unique assyncronos; MSC is a XY Chart. This works well until now data records changed to 2 assyncronos sources. The format is now: where the data comes from (0,1) + time + 8 channels of data.

    Rgds,


  • My laptop recognizes the drive but does show that two files named "My Data Sources" and "Bootsect.

    original title: old Hard Drive Access

    I have recently had problems with my pc, I decided that I will buy a new Tower, but I really need to get some files off the old hard drive, I bought and pregnant for the SATA drive out of my old pc. I'm now trying to get the files on my old drive through my laptop. The laptop is running Vista. My laptop recognizes the drive but does show that two files named "My Data Sources" and "Bootsect. When looking at the properties it shows that the majority of the disc is full, only 30 gigs for free the 160 GB drive. I don't understand why I can't access to find one of my old files. Help, please!

    Hello

    ·          These files are encrypted?

    Step 1: Step 1: temporarily disable the security software and check if it makes a difference.

    http://Windows.Microsoft.com/en-us/Windows-vist/disable-antivirus-software

    Note: Make sure to allow him to return so that your computer is protected.

    Step 2: Run a check disk.

    http://Windows.Microsoft.com/en-us/Windows-Vista/check-your-hard-disk-for-errors

  • A data source using an app does not not to start

    I'm adopting the tutorial: https://developer.blackberry.com/cascades/documentation/device_platform/data_access/using_data_sourc... at my request. The only difference is that my app is based on the tabs. Following however to add lines in my file qml, makes the application crashes the gray screen with BB10 logo.

        Tab {
            title: "edit list"
            imageSource: "asset:///images/note.png"
            content: Page {
                titleBar: TitleBar {
                    title: "editing list: " + workingOnList
                    visibility: ChromeVisibility.Visible
                }
                Container {
                    id: view
                    ListView {
                        layout: StackListLayout {
                        }
                        preferredWidth: 640.0
                        // Associate the list view with the data model that's defined in the
                        // attachedObjects list
                        dataModel: dataModel
    
                        listItemComponents: [
                            ListItemComponent {
                                type: "item"
    
                                // Use a standard list item to display the data in the model
                                StandardListItem {
                                    title: ListItemData.category_name
                                }
                            } // end of ListItemComponent
                        ]
                    }
    
                    attachedObjects: [
                        GroupDataModel {
                            id: dataModel
                        },
                        DataSource {
                            id: dataSource
    
                            // Load the data from an SQL database, based on a specific query
                            source: "database.db"
                            query: "select * from categories"
    
                            onDataLoaded: {
                                // After the data is loaded, insert it into the data model
                                dataModel.insertList(data);
                            }
                        } // end of DataSource
                    ]
    
                    onCreationCompleted: {
                        // After the root Page is created, direct the data source to start
                        // loading data
                        dataSource.load();
                    }
                }
            }
        }
    

    The only differences are: code is pasted in the {} instead of {Page} tab, and of course, the name of the database, the columns are changed.

    I added bb.data 1.0 import statement in the file .qml, the .pro file was also changed according to the tutorial. Path to the database file is correct.

    You have an idea, why this is happening?

    Another issue related to the data source:

    my main.qml file:

        Page {
            id: mainScreen
            titleBar: TitleBar {
                title: "your lists"
                visibility: ChromeVisibility.Visible
            }
            Container {
                ListView {
                    id: allListsView
                    objectName: "allLists"
    
                    layout: StackListLayout {
                        headerMode: ListHeaderMode.Sticky
                    }
    
                    dataModel: allListsModel
    
                    listItemComponents: [
                        ListItemComponent {
                            type: "item"
    
                            StandardListItem {
                                title: ListItemData.list_name
                            }
                        },
                        ListItemComponent {
                            type: "header"
                            Header {
                                title: ListItemData
                            }
                        }
                    ]
                    onTriggered: {
                        select(indexPath);
                        var page = listPage.createObject();
                        nav.push(page);
                    }
                }
    
                attachedObjects: [
                    ComponentDefinition {
                        id: listPage
                        source: "listPreview.qml"
                    },
                    GroupDataModel {
                        id: allListsModel
                        grouping: ItemGrouping.ByFirstChar
                        sortingKeys: ["list_name"]
                    },
                    DataSource {
                        id: allListsSource
    
                        source: "database.db"
                        query: "select * from lists"
    
                        onDataLoaded: {
                            allListsModel.insertList(data);
                        }
                    }
                ]
    
                onCreationCompleted: {
                    allListsSource.load();
                }
            }
    

    New screen grows without any problem after clicking on list items. But when I add the following lines to listPreview.qml, application stucks selection list item and nothing happens.

    Page {
    
        content: ListView {
            id: myListView
    
            dataModel: dataModel
    
            listItemComponents: [
                ListItemComponent {
                    type: "item"
    
                    StandardListItem {
                        title: ListItemData.article_name
                    }
                }
            ]
        }
    
        attachedObjects: [
            GroupDataModel {
                id: dataModel
            },
            DataSource {
                id: dataSource
    
                source: "database.db"
                query: "select * from articles"
    
                onDataLoaded: {
                    dataModel.insertList(data);
                }
            }
        ]
    
        onCreationCompleted: {
            dataSource.load();
        }
    }
    

    It looks like I can not query the DB for the second time commenting on the DataSource {...} of listPreview.qml pushed the new app screen without any problems.

    EDIT:

    a simple solution: I forgot to add the statement import bb.data 1.0 in listPreview.qml

  • Data source - undefined reference

    I'm trying to implement a data source as described here:

    https://developer.BlackBerry.com/Cascades/documentation/device_platform/data_access/using_data_sourc...

    I have included:

    #include

    And in my main application I have included:

    BB::data:ataSource::registerQmlTypes();

    However, on the compilation I have the following error:

    C:\Users\ndk-10.0.6-workspace\carosel_2\arm/... /SRC/Carousel.cpp:40: reference to the undefined ' bb::data:ataSource::registerQmlTypes () '

    How can I fix it?

    Have you added the LIBS +=-lbbdata in your .pro file?

  • QNetworkReply running into the problem of loading JSON data

    Hello

    I am a beginner with C++ and QT, but so far I'm starting to love the NDK waterfall!

    I'm trying to load a json data file that is extracted via a http request. Everything goes through, but my json data simply would not load in the QVariantList. So after a few hours of poking arround, I noticed finally that the json returned by the http request data is missing two brackets [] (an @ beginning and an end @).

    When I load the json data into a file with the two brakets included, the QVariantList load properly and I can debug through the records...

    Now my question is... how C++ can I add those parentheses []... See the code example below:

    void MyJSONReadClass::httpFinished()
    {
      JsonDataAccess jda;
      QVariantList myDataList;
    
      if (mReply->error() == QNetworkReply::NoError)
      {
        // Load the data using the reply QIODevice.
        qDebug() << mReply;
        myDataList = jda.load(mReply).value();
      }
      else
      {
        // Handle error
      }
    
      if (jda.hasError())
      {
        bb::data::DataAccessError error = jda.error();
        qDebug() << "JSON loading error: " << error.errorType() << ": "
            << error.errorMessage();
        return;
      }
    
      loadData(myDataList);
    
      // The reply is not needed now so we call deleteLater() function since we are in a slot.
      mReply->deleteLater();
    }
    

    Also, I would have thought that the jda.hasError () have captured this question... but guess not!

    I use the wrong approach or wrong classes? The basic example used is the WeatherGuesser project.

    Thanks for your help...

    It is perhaps not related to media. Try to recover data from QNetworkResponse as a QByteArray then load it into JsonDataAccess using loadFromBuffer:

     myDataList = jda.loadFromBuffer(mReply.readAll()).value();
    

    If this is insufficient, you can add media in this way (not tested, please see the documentation for the names of functioning if it won't compile):

    QByteArray a = mReply.readAll();
    a.insert(0, '[');
    a.append(']');
    myDataList = jda.loadFromBuffer(a).value();
    

    Note that if the response data are zero end (most likely it is not, but there is a possibility of it), you will need to check if the last symbol in byte array is '\0' and insert the capture media.

    QByteArray docs:

    http://Qt-project.org/doc/Qt-4.8/QByteArray.html

Maybe you are looking for

  • Norton Toolbar does not work with Firefox 17, provided Comcast Norton Security Suite, Win 7.

    I have Norton Security Suite provided by Comcast. Norton Toolbar does not work with Firefox 17.0.1 on my Win 7 machine. I lived all the questions on this topic and did all the steps and when I click on "Add-ons", he always says that the toolbar is no

  • Passing values to sub VI and write data to controls

    As part of a control for a VFD interface I am interfacing with via Modbus TCP, I wanted to try some of my code partition in a Subvi However, in doing so, I will be very difficult to understand how I can read the current settings of player for the ram

  • Windows media player displays the video like a color negative

    Had to wipe my hard drive and do a reinstall of Win - XP. Media player format has changed (another screen w / options) when you open attachments to emails, they play like color negatives. The audio seems normal, but the video is very bad.

  • Laptop suspended

    Hello everyone. I have an Alienware m17x r4. I got it for four years and its been absolutely brilliant. But these last three days its been acting weird vey. It starts on the first of these three days and hang just at the moment where he slowed. Then

  • Screen problem gold Alpha 10 parameters of Simulator

    Hi all I have problem to access settings screen on Simulator. When I click on the 'Settings', black screen with text Blackberry 10 application icon. And the Simulator does not engage further. What should I do here? Thank you and best regards, Shubhan