1
$\begingroup$

I have a function (whose code is in this site) to display Dataset in a more convenient way. To the extent that I never use the default one. I find myself constantly writing a code with a double entry:

allReportsWithDesc = 
  Query[Select[StringMatchQ[#Label, "[D0" ~~ ___] &], {"Label", 
     "Description"}]@dsNodes;
DisplayDatasetLive[allReportsWithDesc]

That is I suppress default output then use an alternative output.

I could write:

allReportsWithDesc = 
      Query[Select[StringMatchQ[#Label, "[D0" ~~ ___] &], {"Label", 
         "Description"}]@dsNodes;%//DisplayDatasetLive

I am wondering, however, if there was not a way to change the default display for Dataset to use DisplayDatasetLive. So I could write simply:

allReportsWithDesc = 
  Query[Select[StringMatchQ[#Label, "[D0" ~~ ___] &], {"Label", 
     "Description"}]@dsNodes

and the display would use DisplayDatasetLive (or some other function for that matter).

$\endgroup$
  • 1
    $\begingroup$ Look up $Post. $\endgroup$ – J. M. is away Mar 9 '16 at 11:35
  • $\begingroup$ That's a useful functionality to know. So: $Post = If[Head[#] === Dataset, DisplayDatasetLive[#]] &; works like a charm. Thanks. $\endgroup$ – Trad Dog Mar 9 '16 at 11:44
  • 1
    $\begingroup$ You will want to actually use If[Head[#] === Dataset, DisplayDatasetLive[#], #] & so that other outputs are not affected. $\endgroup$ – J. M. is away Mar 9 '16 at 11:48
  • $\begingroup$ Yes, that's correct. Thanks $\endgroup$ – Trad Dog Mar 9 '16 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.