8 – Conditional Show/Hide Child Terms on Edit Page

I have a content type with a term reference. The terms have child terms. On the admin editing side, I want to show only top level terms until selected, then show only the child terms for that parent.

This to prevent having a ginormously long field.

Parent 1
  Child 1
  Child 2
Parent 2
  Child 3
  Child 4
Parent 3
...

When a user edits a piece of content, I want to only show the parent terms initially. Then show/hide the child terms when the parent is checked.

Parent 1
Parent 2 (checked)
  Child 3
  Child 4
Parent 3
Parent 4
...

I’ve used conditional fields, state API, and select (other) modules. But this is showing and hiding children on the same field. So it’s a bit different.

Anyone have any advice for this scenario?

Complex conditional logic for Webform field

I have a complex scenario in Webforms, where field #states depends on multiple OR / AND conditional logic.

For Example:

field_d has a visibility condition where field_a must be filled and either of field_b or field_c must be filled. I am not sure how to proceed with that kind of Yaml logic. I have tried something like below but it seems not to work.

visible:

  ':input(name="field_a")':
      filled: true

  and

  (
  ':input(name="field_b")':
      filled: true

  or

  ':input(name="field_c")':
      filled: true
  )

Thanks.

conditional formatting – Using a custom formula on a sheet that is constantly expanding

A custom formula for 5 possible colors, by day is used to highlight entries by DayOfWeek

Is it possible to use a format like A2:A instead of manually editing it as the sheet grows bigger?

Formula works fine, just don’t want to be editing it continuously

Example for rows A2 to A641 – can this be $A$2:$A ?

=and(isblank($A$2:$A$641)=false,OR(weekday($A$2:$A$641)=7))

How do I apply more than one conditional formatting rule using JSON to a SP Online List column?

You cannot apply multiple JSON formatting codes to single column. So, you have to manage multiple conditions/rules within same JSON.

For changing color to red when number is negative, add below code in your existing JSON:

...

"style": {
      "color": "=if(@currentField < 0, 'red', '#323130')"
}

...

Documentation: Use column formatting to customize SharePoint

javascript – How to check if type is undefined in Typescript Conditional Types?

I currently have this type:

type ReturnType<T, E> = [T, E]

I ‘m trying to make this type “smarter” by these rules:

  • If T is undefined, then the type would be [undefined, E]
  • If E is undefined, then the type would be [T]
  • T and E can’t both be undefined

I’m trying to apply these rules using Typescript’s Conditional Types.
Is this even possible to implement?

This is what I got so far:

type ReturnType<T, E> = T extends undefined ? [undefined, E] : [T]

bessel functions – Compute the conditional probability distribution of a noncentral $chi$ variable given the range of Erlang distributed non-centrality parameter

I need to compute a conditional probability distribution as described below for my research.

In $(mathbb R^2,||cdot||_2)$, I have a random vector $underline{z}$ with uniformly distributed angle and $Z=||underline{z}||$ following Erlang distribution with $k=2$ and scale parameter $mu$, i.e. with the density function $f_Z(z)=frac{z}{mu^2}e^{-frac{z}{mu}}$. I have another normal random vector $underline{y}$ independent of $underline{z}$. I’m interested in the resultant vector $underline{x}=underline{y}+underline{z}$ and want to compute the conditional distribution of $X=||underline{x}||$ given $aleq||underline{z}||leq b,0leq a<bleqinfty$, to be specific, the complementary cumulative distribution function $overline{F}_{X|Z}(x|(a,b))=P(X>x|aleq Zleq b)$. Solutions for special cases where $Zleq c$ or $Zgeq c$ for any $c>0$ would be sufficient for my research if they are easier to solve.

Following is my attempt. Given a fixed $Z=z$, since $underline{y}$ is normal, $X$ follows the noncentral $chi$ distribution with $k=2$ and non-centrality parameter $lambda=z$, i.e. $f_{X|Z}(x|z)=xe^{-frac{x^2+z^2}{2}}I_0(xz)$, where $I_0(x)=frac{1}{pi}int_0^pi e^{xcosalpha}dalpha$ is a modified Bessel function of the first kind. Then the density function of the conditional distribution is
$$f_{X|Z}(x|(a,b))=frac{int_a^b f_Z(z)f_{X|Z}(x|z)dz}{int_a^b f_Z(z)dz}$$

The denominator $int_a^b f_Z(z)dz=gamma(2,frac{b}{mu})-gamma(2,frac{a}{mu})$ where $gamma$ is the lower incomplete gamma function.

Change the order of integration, the numerator is
$$begin{align}
int_a^b f_Z(z)f_{X|Z}(x|z)dz & = frac{1}{pi}int_a^bfrac{z}{mu^2}e^{-frac{z}{mu}}xe^{-frac{x^2+z^2}{2}}int_0^pi e^{xcosalpha}dalpha \
& = frac{x}{pimu^2}e^{-frac{x^2}{2}}int_0^pi e^{frac{1}{2}(frac{1}{mu}-xcosalpha)^2}int_a^b ze^{-frac{1}{2}(z+frac{1}{mu}-xcosalpha)^2}dzdalpha \
& = frac{x}{pimu^2}e^{-frac{x^2}{2}}int_0^pi e^{frac{beta^2}{2}}left(e^{-bar{a}^2}-e^{-bar{b}^2}+sqrt{frac{pi}{2}}left(operatorname{erf}bar{a}-operatorname{erf}bar{b}right)right)dalpha
end{align}$$

where $beta=frac{1}{mu}-xcosalpha$, $bar{a}=frac{a+beta}{sqrt{2}},bar{b}=frac{b+beta}{sqrt{2}}$, $operatorname{erf}$ is the error function.

Then I got stuck at the second integral. I am looking for an analytical expression of $f_{X|Z}(x|(a,b))$. I tried numerical integration and compared it to a simulation using matlab. The results are as expected.

Finally, what I want is an analytical expression of $overline{F}_{X|Z}(x|(0,c))=P(X>t|Zleq c)=int_t^infty f_{X|Z}(x|(0,c))dx$ and $overline{F}_{X|Z}(x|(c,infty))=P(X>t|Zgeq c)=int_t^infty f_{X|Z}(x|(c,infty))dx$.

Is it possible?

Conditional Probability of first and second letters in a data set of strings

I have a dataset of strings and I would like to take only the first two letters of each string and find the conditional probability P(Second Letter|First Letter) while only looking at the words of the dataset. I can split the words and make another list with only the first two letters of each word but I’m having difficulty figuring out a way to say for example, all of the two-letter word snippets that start with ‘a’ what is the probability that a,b,c…z will follow as the second letter. I want to do the probability for every letter pair and put it into a 3D histogram where the x-axis will be the first letter chosen, the y-axis will be the second letter and the height will be the probability that that pair occurs within the chosen dataset.

Example:
Original dataset {cat,dog,human}
dataset split to only include the first two letters {ca,do,hu}

I’ve been trying to figure out a way to do it and I just can’t seem to get it. I attempted to search to see if anyone has asked a question like mine but I didn’t see anything like it. Any help is thoroughly appreciated.

google sheets – Conditional formatting with GOOGLEFINANCE

I wanted to keep a track of my portfolio using google sheet.

e.g: if i buy a share let’s say on 07th April 2021 and i know my trigger price, Target 1 , target 2 & SL. i want google sheet to mark each of them with specific color as soon as CMP matches one and another of trigger price, T1, T2 & SL until i sell them.

Share CMP BUY T1 T2 SL Buy Date Sell Date
HDFC 2450 2400 2550 2600 2390 07/04/2021

How to acheive it, i tried comparing CMP columns with other columns but as the prices keeps changing i am unable to track it.