Skip to content

Commit ed5c9c4

Browse files
committed
Add default value for BOOLEAN. Improve README
1 parent 9d3f7d2 commit ed5c9c4

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ It allows to load data from a SPARQL endpoint using SELECT queries.
77
## Getting started
88

99
1. Open the [link](https://datastudio.google.com/datasources/create?connectorId=AKfycbzDHEBN9qHXPni4xO4P2cIZtyQ3rnYmzkCnVsnh9oEJrnhGe4MntBF-t1zAu2Lm-Vjc) to create a new Data Source.
10-
1. Once authorization has successfully completed, you're ready to configure the parameters. You should be see the form:
10+
1. Once authorization has successfully completed, you're ready to configure the parameters. You should see the form:
1111

1212
![Screenshot of the configuration page](screenshot_parameters.png)
1313

@@ -36,7 +36,7 @@ It allows to load data from a SPARQL endpoint using SELECT queries.
3636
* `dateRange.endDate` - format `YYYY-MM-DD`, e.g. 2018-10-01,
3737
* `dateRange.numDays` - it's a positive integer value.
3838
39-
If you don't use `dateRange.startDate` and `dateRange.endDate`, then you won't be able to use **Date range** filter.
39+
If you don't use `dateRange.startDate` or `dateRange.endDate`, then **Date range** filter won't be able to control the date range.
4040
4141
1. Enter the schema of projections, e.g.
4242
@@ -60,6 +60,18 @@ Google Data Studio uses it's own formats for some of the data types. Therefore t
6060
* `xsd:dateTime` is converted to `YYYYMMDDHH`,
6161
* `xsd:duration` is converted to an integer corresponding to the number of seconds.
6262
63+
## Default values
64+
65+
The connector may apply default values in query results which don't a value for a requested field. The default values:
66+
67+
Datatype | Default value
68+
-----------|--------------
69+
`NUMBER` | `0`
70+
`BOOLEAN` | `false`
71+
`STRING` | `""`
72+
73+
If you don't like these defaults, then write your query in a way when it can't have missing/empty values, especially in case of `GROUP BY`.
74+
6375
## License
6476
6577
MIT License

utils.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ function reformatByDatatype(value, xsdDatatype) {
2020
function getDefaultValue(schema) {
2121
if(schema.dataType == "NUMBER") {
2222
return 0;
23+
} else if(schema.dataType == "BOOLEAN") {
24+
return false;
2325
} else {
2426
return "";
2527
}

0 commit comments

Comments
 (0)