Empty columns when querying - exact-online

When using the Invantive Query Tool to request the table GLTransactionlines on Exact Online, my query times out.
When selecting a single column the query returns no data. Specifically, I would like to know from what table I can request my Transaction Lines.
I have used the following query:
select division_code
, gltransaction_date
, gltransaction_journal_code_attr
, glaccount_code_attr
, amount_value
, glaccount_balancetype_attr
from gltransactionlines
where glaccount_balancetype_attr = 'W';
local export results as "${rptoutpath}\TransactionsPLlsc.xlsx" format xlsx
When I select *, the Invantive Query Tool returns that there are too many columns in GLTransactionLines.
The exact error is:
De externe server heeft een fout geretourneerd: (401) Niet gemachtigd.
It occurs after ten minutes. When I let run DebugView along, it shows me that the following URL does not return:
Load Exact Online data using URL 'https://start.exactonline.nl/Docs/XMLDownload.aspx?Topic=gltransactions&Params_details=1&Params_documents=0&_Division_=1362280'
When I try to export another Exact Online table, it works. And sometimes fetching the GLTransactionLines works too.

It seems that the XML API of GL Transaction Lines is slow or malfunctioning on your environment. Please contact your supplier about this. As an alternative, you might want to switch to using the REST API which contains similar data, such as:
select *
from TransactionLines
where financialyear = 2016
and financialperiod = 12

Related

Using FORMAT_DATETIME with Tableau and BigQuery

I'm connecting to BigQuery to get information for a Sankey Diagram in Tableau. However, I am getting this information from 2 different datasets: "audience exited" and "audience entered". I am using the User IDs and the original timestamps to join the 2 datasets. However, the timestamps are in a datetime format and those times do not coincide with each other across datasets given that a user can exit an audience at 2 a.m and only enter a new audience at 4 a.m. Hence, I am using "FORMAT_DATETIME" to remove the time on the original timestamps i.e: from "2021/07/07 23:32" to "2021-Jul-7" as shown in the SQL code below:
SELECT `audience_exited`.`active_customers` AS `active_customers`,
`audience_exited`.`audience_key` AS `audience_key`,
FORMAT_DATETIME("%Y-%b-%d",auience_exited`.`original_timestamp`) AS `original_timestamp`,
`audience_exited`.`received_at` AS `received_at`,
`audience_exited`.`user_id` AS `user_id`,
`audience_entered`.`active_customers` AS `active_customers__audience_entered_`,
`audience_entered`.`audience_key` AS `audience_key__audience_entered_`,
FORMAT_DATETIME("%Y-%b-%d",`audience_entered`.`original_timestamp`) AS `original_timestamp__audience_entered_`,
`audience_entered`.`received_at` AS `received_at__audience_entered_`,
`audience_entered`.`user_id` AS `user_id__audience_entered_`,
"audience_key" AS Vizside
FROM `dial-a-delivery-ke.personas_personas_prod`.`audience_exited` `audience_exited`
FULL JOIN `dial-a-delivery-ke.personas_personas_prod`.`audience_entered` `audience_entered` ON ((`audience_exited`.`user_id` = `audience_entered`.`user_id`) AND (`audience_exited`.`original_timestamp` = `audience_entered`.`original_timestamp`))
I get the following error when I run it in Tableau:
An error occurred while communicating with the data source
Error Code: 015CFBE6 The Google BigQuery service was unable to compile
the query. Syntax error: Expected ")" but got identifier . at [5:46]
And I do not know what to make of this since everything seems fine to me. Please can you assist with this error?
TRY BELOW CODE
SELECT `audience_exited`.`active_customers` AS `active_customers`,
`audience_exited`.`audience_key` AS `audience_key`,
FORMAT_DATETIME("%Y-%b-%d",`auience_exited`.`original_timestamp`) AS `original_timestamp`,
`audience_exited`.`received_at` AS `received_at`,
`audience_exited`.`user_id` AS `user_id`,
`audience_entered`.`active_customers` AS `active_customers__audience_entered_`,
`audience_entered`.`audience_key` AS `audience_key__audience_entered_`,
FORMAT_DATETIME("%Y-%b-%d",`audience_entered`.`original_timestamp`) AS `original_timestamp__audience_entered_`,
`audience_entered`.`received_at` AS `received_at__audience_entered_`,
`audience_entered`.`user_id` AS `user_id__audience_entered_`,
"audience_key" AS Vizside
FROM `dial-a-delivery-ke.personas_personas_prod`.`audience_exited` `audience_exited`
FULL JOIN `dial-a-delivery-ke.personas_personas_prod`.`audience_entered` `audience_entered` ON ((`audience_exited`.`user_id` = `audience_entered`.`user_id`) AND (`audience_exited`.`original_timestamp` = `audience_entered`.`original_timestamp`))

itgenoda074 SysAccessDenied on retrieval of binary blob in DocumentAttachmentFiles

When I execute the following query on Exact Online:
use 450*** /* Replace anonymized *** by last three digits of division. */
set use-http-disk-cache false
set use-http-memory-cache false
select * from ExactOnlineREST..DocumentAttachmentFiles where id = to_guid('8b60ccb6-e89d-4397-a4ca-001d6f57a4eb')
I get an error:
itgenoda074: Uw sessie is verlopen. Meld je opnieuw aan. [Session expired]
itgenoda074: Not authenticated. Request to 'https://start.exactonline.nl/docs/SysAttachment.aspx?ID=8b60ccb6-e89d-4397-a4ca-001d6f57a4eb&_Division_=450***' gave response from 'https://start.exactonline.nl/docs/SysAccessDenied.aspx?Mode=128&_Division_=450***'.
This happens both directly after a long session as well as straight after log on, so the token is still valid.
How can I access the document using Invantive SQL?
I have all privileges on the Exact Online environment for the owning company.
The following will not help since it is a recursive API calls (from file metadata to actual blob):
set ignore-http-403-errors false
But you can ignore any errors during recursive retrieval of the actual binary blob:
set ignore-document-download-errors true
After that, run the following query to determine the document ID associated with the attachment:
select document from ExactOnlineREST..DocumentAttachmentFiles where id = to_guid('8b60ccb6-e89d-4397-a4ca-001d6f57a4eb')
And put the document GUID in the following query:
select * from exactonlinerest..documents where id=to_guid('VALUE FROM PREVIOUS QUERY')
Probably you will retrieve 0 rows. Sometimes the document attachment files continue to exist while the document is no longer available.
If so, report it to Exact Online themselves. Their APIs should return referential correct data.
If not, please extend your question.

Streaming Analytics Query Error

When typing my query for Streaming Analytics I don't receive any error messages, however, when I start my streaming analytics job, I receive the following error:
Stream Analytics job has validation errors: The output dsleads used in the query was not defined. Activity Id: '5cc961c5-4dbd-4a63-95df-8e3b08d2121c-2016-03-28 14:56:21Z'.
I've checked the output name and have verified that it's correct. I'm not sure what I'm doing wrong. The query I'm using is as follows:
SELECT type, count(*) as count, system.timestamp as time
INTO dsleads
FROM ttvhuball timestamp by time
GROUP BY type, TumblingWindow(minute, 10)
I've scoured the internet and have not found anything helpful.
seems like an output alias error. Is the output sink alias that you've created(that is you give a name to it during creation) "dsleads" in your case?
Also worth mentioning INTO is the output and FROM is the input. INTO always needs to come before FROM in the query as well.
Hope this helps!
Mert
I was using the incorrect output name. One needs to specify the output name. I was specifying the dataset name of the output I needed to specify.

JSON Queries - Failed to execute

So, I am trying to execute a query using ArcGIS API, but it should match any Json queries. I am kind of new to this query format, so I am pretty sure I must be missing something, but I can't figure out what it is.
This page allows for testing queries on the database before I actually implement them in my code. Features in this database have several fields, including OBJECTID and Identificatie. I would like to, for example, select the feature where Identificatie = 1. If I enter this in the Where field though (Identificatie = 1) an error Failed to execute appears. This happens for every field, except for OBJECTID. Querying where OBJECTID = 1 returns the correct results. I am obviously doing something wrong, but I don't get it why OBJECTID does work here. A brief explanation (or a link to a page documenting queries for JSON, which I haven't found), would be appreciated!
Identificatie, along with most other fields in the service you're using, is a string field. Therefore, you need to use single quotes in your WHERE clause:
Identificatie = '1'
Or to get one that actually exists:
Identificatie = '1714100000729432'
OBJECTID = 1 works without quotes because it's a numeric field.
Here's a link to the correct query. And here's a link to the query with all output fields included.

get all records matching the query string and display like in google suggest by google

What I want to do is, somewhat similar to google suggest.
My client page will submit the search text through ajax to server. The server will grab that text and query all the records matching that string and return back to client page.
e.g.
text_frm_client = "Ba". The query will show all the records beginning with "Ba"
The raw sql query to achieve my problem is
**Select * from table_name where column1 LIKE "Ba%" or column2 LIKE "Ba%"**
Now I want to port this query to django model. What I found is somewhat somewhat similar.
https://docs.djangoproject.com/en/dev/ref/models/querysets/#std:fieldlookup-contains
But this is only for one field. How can I accomplish the sql query with django model.
You can use the Q
data = MyModel.objects.filter(
Q(column1__contains="Ba") |
Q(column2__contains="Ba")
)