Adding export button on product grid causes error - button

I added in product_listing.xml and when I'm clicking export button, I get this error:
A joined field with this alias is already declared.","1":"#1 Magento\CatalogInventory\Ui\DataProvider\Product\AddQuantityFieldToCollectio->addField()
This is the full report:
{
"0": "A joined field with this alias is already declared.",
"1": "#1 Magento\\CatalogInventory\\Ui\\DataProvider\\Product\\AddQuantityFieldToCollection->addField() called at [vendor/magento/module-catalog/Ui/DataProvider/Product/ProductDataProvider.php:108]\n#2 Magento\\Catalog\\Ui\\DataProvider\\Product\\ProductDataProvider->addField() called at [vendor/magento/module-ui/Component/Listing/Columns/Column.php:121]\n#3 Magento\\Ui\\Component\\Listing\\Columns\\Column->addFieldToSelect() called at [vendor/magento/module-ui/Component/Listing/Columns/Column.php:73]\n#4 Magento\\Ui\\Component\\Listing\\Columns\\Column->prepare() called at [vendor/magento/module-ui/Component/MassAction/Filter.php:189]\n#5 Magento\\Ui\\Component\\MassAction\\Filter->prepareComponent() called at [vendor/magento/module-ui/Component/MassAction/Filter.php:187]\n#6 Magento\\Ui\\Component\\MassAction\\Filter->prepareComponent() called at [vendor/magento/module-ui/Component/MassAction/Filter.php:187]\n#7 Magento\\Ui\\Component\\MassAction\\Filter->prepareComponent() called at [vendor/magento/module-ui/Component/MassAction/Filter.php:212]\n#8 Magento\\Ui\\Component\\MassAction\\Filter->getDataProvider() called at [vendor/magento/module-ui/Component/MassAction/Filter.php:130]\n#9 Magento\\Ui\\Component\\MassAction\\Filter->applySelectionOnTargetProvider() called at [vendor/magento/module-ui/Model/Export/ConvertToCsv.php:72]\n#10 Magento\\Ui\\Model\\Export\\ConvertToCsv->getCsvFile() called at [vendor/magento/module-ui/Controller/Adminhtml/Export/GridToCsv.php:70]\n#11 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv->execute() called at [vendor/magento/framework/App/Action/Action.php:108]\n#12 Magento\\Framework\\App\\Action\\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:248]\n#13 Magento\\Backend\\App\\AbstractAction->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#14 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv\\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#15 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:143]\n#16 Magento\\Backend\\App\\Action\\Plugin\\Authentication->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#17 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#18 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv\\Interceptor->___callPlugins() called at [generated/code/Magento/Ui/Controller/Adminhtml/Export/GridToCsv/Interceptor.php:26]\n#19 Magento\\Ui\\Controller\\Adminhtml\\Export\\GridToCsv\\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:186]\n#20 Magento\\Framework\\App\\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:118]\n#21 Magento\\Framework\\App\\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#22 Magento\\Framework\\App\\FrontController\\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#23 Magento\\Framework\\App\\FrontController\\Interceptor->Magento\\Framework\\Interception\\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#24 Magento\\Framework\\App\\FrontController\\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]\n#25 Magento\\Framework\\App\\FrontController\\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]\n#26 Magento\\Framework\\App\\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]\n#27 Magento\\Framework\\App\\Bootstrap->run() called at [pub/index.php:40]\n",
"url": "/admin_1o95s2/mui/export/gridToCsv/key/fb96aef93ff63095902eca65bc49652bd4f3df87563b39848f88b05f58aea0e1/?filters%5Bplaceholder%5D=true&search=&namespace=product_listing&selected%5B%5D=6446",
"script_name": "/index.php",
"report_id": "3f3c2a74a0d9154b716f3ed0b45333cec960249324777be3363630145e0f39fb"
}
Thanks in advance

Related

hasura_session invocation without arguments

There is a function:
CREATE OR REPLACE FUNCTION public.drops(cases_free_row cases_free, hasura_session json)
RETURNS SETOF drops
LANGUAGE sql
STABLE
AS $function$
SELECT *
FROM drops d
WHERE d.caseid = cases_free_row.id
AND d.userid = (hasura_session ->> 'x-hasura-user-id') :: INT
$function$
When I try to call, I need to enter the arguments
{
"errors": [
{
"extensions": {
"path": "$.selectionSet.cases_free.drops.args",
"code": "not-supported"
},
"message": "Non default arguments cannot be omitted"
}
]
}
Is it possible to get data without entering arguments?
Hasura v1.2.0-beta.3
You need the first args cases_free_row but for the second args hasura_session there, here's how to make it available to your function:
In Hasura Console go to Data, under Untracked Custom Functions, click track.
Your custom function will appear on left side panel, click to open
Then under Session argument insert hasura_session
Your specific postgres function requires arguments, so no.

Customize the console printing for S4/RC objects in R

In R we can simply type the variable name in the console, the console will automatically print out the value. I have created a new S4/RC class define, and would like to create a nicer way to automatically "print" in the console. How do I edit the console printing functions for a new class?
Here is my code in the console:
ClassA<-setRefClass("ClassA",fields=list(value="numeric"))
"print.ClassA"<-function(object){
cat("--------\n")
cat(object$value,"\n")
cat("--------\n")
}
classobject<-ClassA$new(value=100)
classobject # it doesn't print nicely in the console.
#Reference class object of class "ClassA"
#Field "value":
#[1] 100
print(classobject) # this works
#--------
#100
#--------
My goal is to avoid typing "print" all the time; just type the object name in the console, it will print out nicely, just like calling print().
Thanks!
You need to define a show method for your RefClass object. Read ?setRefClass for details regarding how to write methods. This works:
#the print function: note the .self to reference the object
s<-function(){
cat("--------\n")
cat(.self$value,"\n")
cat("--------\n")
}
#the class definition
ClassA<-setRefClass("ClassA",fields=list(value="numeric"),methods=list(show=s))
classobject<-ClassA$new(value=100)
classobject
#--------
#100
#--------

The value of one of my ReportParameters is getting overriden

I have the following block of code.
reportViewer.ServerReport.ReportPath = LookUpFacade.GetReportFileNameFromDefinition(reportDisplayType.ReportDefinitionID);
reportViewer.ServerReport.SetParameters(reportParameterCollection);
When I add a parameter called "Car" with a value of "Honda", it shows in the reportParameterCollection, but after I set the ReportPath, and I do a reportViewer.ServerReport.GetParameters(), the parameter "Car" is there with a Values property (it can contain multiple values) that is empty (count of 0).
The reportParameterCollection has "Car" with a value of "Honda" but once I call SetParameters, the value is overridden in the ServerReport.GetParameters().
Any ideas?
Actually it had nothing to do with the code. I was passing in the incorrect parameters. I was passing a student id that didn't belong to the requested school.

Creating a log file with the name as "Logging_20120402.log" where 20120402 is current date

I am working on a logging project i want the name of the loggign file that gets created to be like :-
Logging_20120402.log
where 20120402 is the current date since this is a rotation log so every day when the date changes the name of the log file gets changing too for example if a ne file would get created tomorrow it would have the name as
Logging_20120403.log
i tried using this code however it didnt work
i have in my project a filelogger.cpp which has a function:-
string Lastdate()
{
returns date1;//also declared as global in this filelogger.cpp
}
now when i use it in my main program what i did was this
void test()//function
{
string* ptr = &date1;//i passed a pointer ptr to the address of the date1(filecreation
}
now i write the staement as:-
Logging::FileLogger filelog(logger, "logging_" + ptr + ".log");//creating a
Daily.log text File
i am expecting this statement to create a file as Logging_20120402.log at the path
specified,however there is a compile time error,need help

UDK "Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'"

Upon compiling, I am getting the following error:
C:\UDK\UDK-2010-03\Development\Src\FixIt\Classes\ZInteraction.uc(41) : Error, Unrecognized member 'OpenMenu' in class 'GameUISceneClient'
Line 41 is the following:
GetSceneClient().OpenMenu("ZInterface.ZNLGWindow");
But when I search for OpenMenu, I find that it is indeed defined in GameUISceneClient.uc of the UDK:
Line 1507: exec function OpenMenu( string MenuPath, optional int PlayerIndex=INDEX_NONE )
It looks like I have everything correct. So what's wrong? Why can't it find the OpenMenu function?
From the wiki page on Legacy:Exec Function:
Exec Functions are functions that a player or user can execute by typing its name in the console. Basically, they provide a way to define new console commands in UnrealScript code.
Okay, so OpenMenu has been converted to a console command. Great. But still, how do I execute it in code? The page doesn't say!
More searching revealed this odd documentation page, which contains the answer:
Now then, there is also a function
within class Console called 'bool
ConsoleCommand(coerce string s)'. to
call your exec'd function,
'myFunction' from code, you type:
* bool isFunctionThere; //optional
isFunctionThere = ConsoleCommand("myFunction myArgument");
So, I replaced my line with the following:
GetSceneClient().ConsoleCommand("OpenMenu ZInterface.ZNLGWindow");
Now this causes another error which I covered in my other question+answer a few minutes ago. But that's it!
Not sure if this is your intent, but if you are trying to create a UIScene based on an Archetype that has been created in the UI Editor, you want to do something like this:
UIScene openedScene;
UIScene mySceneArchetype;
mySceneArchetype = UIScene'Package.Scene';
GameSceneClient = class'UIRoot'.static.GetSceneClient();
//Open the Scene
if( GameSceneClient != none && MySceneArchetype != none )
{
GameSceneClient.OpenScene(mySceneArchetype,LocalPlayer(PlayerOwner.Player), openedScene);
}

Resources