示例#1
0
        public void TestReadTable()
        {
            SCBClient reader = new SCBClient("api.scb.se/OV0104");

            SCBNode node = new SCBNode
            {
                path = "http://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0401/BE0401A/BefolkPrognRevN",
                type = "t",
                id   = "BefProgFoddaMedel19"
            };

            SCBMetaData meta = reader.GetMetaData(node.path).Result;

            SCBQuery query = new SCBQuery {
                response = new SCBResponse("json")
            };

            query.SetUp(meta.variables);

            query.SetSelection(meta.variables.Find(s => s.code == "Fodelseregion"), SCBQuery.Filter.item, new List <string>()
            {
                "13"
            });
            query.SetSelection(meta.variables.Find(s => s.code == "Kon"), SCBQuery.Filter.item, new List <string>()
            {
                "1"
            });
            query.SetSelection(meta.variables.Find(s => s.code == "Tid"), SCBQuery.Filter.item, new List <string>()
            {
                "2020"
            });

            SCBTable table = reader.GetTable(node, query).Result;
        }
示例#2
0
        private void UpdateMetadata()
        {
            if (_currentMetaData != null)
            {
                labelTitle.Text = _currentMetaData.title;

                listBoxVariables.Items.Clear();
                listBoxVariables.Text = "Variables";
                foreach (SCBVariable metaVariable in _currentMetaData.variables)
                {
                    listBoxVariables.Items.Add(metaVariable);
                }

                // default query
                _currentQuery = new SCBQuery();
                _currentQuery.SetUp(_currentMetaData.variables);

                listBoxVariables.SelectedIndex = 0;
                SCBVariable var = listBoxVariables.SelectedItem as SCBVariable;
                if (var != null)
                {
                    UpdateSelectedItems(var);
                }
            }
        }