I'm using to paramters with following commands:
[BUSINESS VIEW].[All Business View].[STAGES] in (prompt('STAGES1','string','Arrival announced'))
and
[BUSINESS VIEW].[All Business View].[NEXTSTAGE] in (prompt('NEXTSTAGE','string','Arrival announced'))
As you see what i'm trying to do is set default value in case user didn't select one both of them are optional.
When running the report i get this error:
"XQE-DAT-0001
Data source adapter error: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=PROMPT;FUNCTION, DRIVER=3.63.123 - when processing query: SELECT
"COGNOS"."TERMINALNAME" AS "TERMINALNAME",
"COGNOS"."CCN" AS "CCN",
"COGNOS"."CIDENTIFICATION" AS "CIDENTIFICATION",
"COGNOS"."STAGES" AS "STAGES",
"COGNOS"."NEXTSTAGE" AS "NEXTSTAGE",
SUM("COGNOS"."TIMETAKEN") AS "TIMETAKEN"
FROM
"KAP"."COGNOS" "COGNOS"
WHERE
"COGNOS"."STAGES" IN (
prompt('STAGES1','string','Arrival announced') ) AND
"COGNOS"."NEXTSTAGE" IN (
prompt('NEXTSTAGE','string','Arrival announced') )
GROUP BY
"COGNOS"."TERMINALNAME",
"COGNOS"."CCN",
"COGNOS"."CIDENTIFICATION",
"COGNOS"."STAGES",
"COGNOS"."NEXTSTAGE"."
I keep trying all day to get to set default value to parameter in case user didn't select but didn't find a way to get it run successfully. Anyone had luck with that ?
[BUSINESS VIEW].[All Business View].[STAGES] in (#promptmany('STAGES1','string','''Arrival announced''')#)
and
[BUSINESS VIEW].[All Business View].[NEXTSTAGE] in (#promptmany('NEXTSTAGE','string','''Arrival announced''')#)
Related
I want to export all items of type Order, which contain a coupon code named 'TESTCOUPON'. However, when I try to do it, I get this error:
ERROR line 4 at main script: error executing code line at 4 : SQL search error - ORA-00932: inconsistent datatypes: expected - got BLOB
query = 'SELECT item_t0.PK FROM orders item_t0 WHERE ( item_t0.p_appliedcouponcodes = 'TESTCOUPON') AND (item_t0.TypePkString IN (?,?,?) )', values = [8796099149906, 8796099215442, 8796098756690]
I assume from the error that the coupon is stored in a Collection/List - how would I filter by it in this case?
The FlexibleSearch line looks like this:
SELECT {C:PK} FROM {Order as C} WHERE {C:appliedCouponCodes} = 'TESTCOUPON'
I tried using the PK of the coupon code, but it doesn't work either and it presents the same error. I tried using LIKE '%TESTCOUPON%' but then it said 'expected CHAR got BLOB'.
As per the Table structure CouponRedemption having reference of Order
.
so correct query will be as below.
select { o.code },{o.pk},{cr.couponCode} from {Order as o Join CouponRedemption as cr on {cr.order}={o.pk}} where {code}='TESTCOUPON'
Output:
code PK p_couponcode
1050156308 9499773075501 BUY4
1044303645 9499775172653 BUY4
1042057811 9499796897837 BUY4
1049853832 9499798863917 BUY4
I have two DAC's POReceipt, and and POReceiptLine. POReceiptLine containts a field called MfrPartNbr.
I want the user to be able to lookup all the POReceipts where the POReceiptLine.MfrPartNbr is equal to an entered value.
The SQL would be
SELECT *
FROM dbo.POReceipt
WHERE POReceipt.ReceiptNbr IN
(
SELECT ReceiptNbr
FROM dbo.POReceiptLine
WHERE MfrPartNbr = 'MY_ENTERED_PART_NBR'
)
Any idea how to write the BQL Statement for this?
As stated, an inner join won't work in this case because you will receive the same POReceipt multiple times (once for each POReceiptLine). The following BQL query shows how you can get the desired results using a sub query. If mfrPartNbr is an extension field, then replace POReceiptLine.mfrPartNbr with the correct extension name (e.g. POReceiptLineExtension.mfrPartNbr).
PXSelect<POReceipt, Where<Exists<
Select<POReceiptLine,
Where<POReceiptLine.receiptNbr, Equal<POReceipt.receiptNbr>,
And<POReceiptLine.mfrPartNbr, Equal<Required<POReceiptLine.mfrPartNbr>>>>>>>>.Select(this, "MY_ENTERED_PART_NBR");
Using Microsoft Azure, I've created a database using easy tables (node.js backend). I have several tables and one view.
There's a trick to making the view work like an easy table which I've done.
Problem:
When using this code to read data from the view, I receive ALL data -- including data for other users.
table.read(function (context) {
return context.execute();
});
That makes sense, as I'm not specifying that I only want the authenticated user's data.
When using this code, I get NO data:
// READ operation
table.read(function (context) {
context.query.where({ userId: context.user.id });
return context.execute();
});
Using the above code for an actual table and not a view works perfectly.
From the log files:
2017-01-02T18:52:00.945Z - silly: Executing SQL statement SELECT TOP 3 * FROM [dbo].[ClassData] WHERE (([userId] = #p1) AND ([deleted] = #p2)); with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
2017-01-02T18:52:00.945Z - silly: Read query returned 2 results
sprintf() will be removed in the next major release, use the sprintf-js package instead.
2017-01-02T18:52:01.867Z - silly: Executing SQL statement SELECT TOP 10 * FROM [dbo].[StacksNamesView] WHERE (([userId] = #p1) AND ([deleted] = #p2)) ORDER BY [createdAt]; with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
2017-01-02T18:52:01.883Z - debug: SQL statement failed - Invalid column name 'userId'.: SELECT TOP 10 * FROM [dbo].[StacksNamesView] WHERE (([userId] = #p1) AND ([deleted] = #p2)) ORDER BY [createdAt]; with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
UPDATE:
When creating Azure App Service EasyTables, the column "userId" is automatically a part of each table. However, it's not visible when looking at the schema via the Azure Portal. This is where my confusion was.
SOLUTION:
When using a view as an EasyTable and you need the "hidden" userId column, just make sure you select it as part of the view! This will work as long as your other EasyTables are executing queries such as the second block of code in this post.
I can't execute a query in Power Query and the error that throws me is like:
Formula.Firewall: Query XXX references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.
The code within this query is as below:
let
CallToFunction = myFunction,
#"Invoked Function" = CallToFunction(),
Source = Oracle.Database("myServer", [Query="SELECT * FROM myTable WHERE CustomerPK IN (" & #"Invoked Function" & ")"])
in
Source
myFunction is a function that uses a couple of other queries and eventually returns a string of primary keys that I can use to fill in the parenthesis of the WHERE clause of my SQL statement.
When I invoke the function alone it works correctly, so this must be an issue of how to call the function within the last query.
Any ideas?
You need to set the privacy settings of your data sources & workbook.
See https://support.office.com/en-ca/article/Privacy-levels-Power-Query-cc3ede4d-359e-4b28-bc72-9bee7900b540?ui=en-US&rs=en-CA&ad=CA
In a Firebird database, I need to create a DOMAIN with default value taken from the context variable.
It should be something like
CREATE DOMAIN USER_ID AS INTEGER
DEFAULT RDB$GET_CONTEXT('USER_SESSION','UID') NOT NULL;
When I execute this, I am getting the following error
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, column 13.
RDB$GET_CONTEXT.
How can this be done, maybe there is another way than the DEFAULT clause?
Just create a BEFORE INSERT trigger:
CREATE TRIGGER your_trigger_name FOR your_table
BEFORE INSERT
POSITION 0
AS
BEGIN
IF (NEW.your_field IS NULL) THEN
NEW.your_field = RDB$GET_CONTEXT('USER_SESSION','UID');
END