How do I use datatable data in a variable for writing to a file? - power-automate-desktop

I'm grabbing some data off of webpages and trying to concatenate with some data pulled from other pages but keep getting the error that the data-tables need to be the same size. What am I missing here?
The datatables are myCoID (just a string) and NumStaff and NumClients- each of which has 1 row and 1 column. I've tried almost every permutation of
%myCoID + NumStaff + NumClients%
%myCoID + NumStaff[0] + NumClients[0]%
%[myCoID + NumStaff + NumClients]%
Where am I going wrong?

Related

Which rule allows for the following reduction?

Let's say I have the following SQL statement:
SELECT 1 + myField + 2
If we want to reduce the expression at the parsing phase before sending it to SQL, we could turn it into:
SELECT 3 + myField
What is the name of the rule that allows this? Another example being:
SELECT myField * (1 + myField * 2 + 3)
Would turn into:
SELECT myField * (4 + (myField * 2) )
That's usually called "constant folding" (which should be a good search term) and it's easier to do as a transformation on the AST than trying to do it while you parse, precisely because of the reordering which is evident in your examples.

How to combine several input data from items to one (string) variable in ztree?

In my experiment, users have the choice between 10 items per round they can select or leave the checkbox emtpy. In the next step, I'd like to create a new variable, e.g. MyInputR1, which holds the values of the previous checkboxes in the right order and as 1 new number.
My approach so far:
a)
Formatting input data: f1=format(D11,0.2).
Combining the input data and storing the information in a new variable: f = f1 + f2 + f3 + ....
Creating the variable MyInputR1 = stringtonumber(f)
b) Combining the input data (with values 0 or 1): MyInputR1 = D11 + D12 + D13 + D14 + ...
Unfortunately, the logic does not sum up and ztree does not understand what I am trying to do.
Thus my question:
Is it possible to combine / string together input data into 1 new variable, instead of adding it up?
Input data: checkbox with values 0 or 1
in total 10 input variables (D11 - D110)
Looking for a variable that e.g. looks like this: MyInputR1 = 0000011111
ztree code
Thanks for your help!

Generated integer array based on number in rails

I want to generate 5 buttons with different values based on one integer.
For example I've got 30, I want to create buttons with 10 20 30 40 50
value = 30
int1 = value - 20
int2 = value - 10
int3 = value
int4 = value + 10
int5 = value + 20
buttoncode = ""
%w{int1 int2 int3 int4 int5}.each do |minutes|
buttoncode += 'buttoncode'
end
I can do it in a very bad way, but it could be done a smarter solution I guess.
Is it possible to make something like that?
%w{sum(max-20) sum(max-10) max sum(max+10) sum(max+20)}.each do |minutes|
end
See Ruby: How to iterate over a range, but in set increments?
So in your case it would be:
(min..max).step(10) do |n|
n += 'buttoncode'
end
By the way, this is not really Rails specific, but Ruby specific. Rails is a web framework that handles the interaction between browser and the web server that is built on top of Ruby.
If you feel like you aren't that up to speed with Ruby, try https://learnrubythehardway.org/book/ and do some exercise on HackerRank or ProjectEuler in Ruby.

Biopython print command prints only the first 25 records parsed, I want to see all

I am parsing a multi-fasta file using Biopython. The "print" command displays the first 25 records on the screen, but I know the file contains more records. I want to see them all. Is 25 a default limit? How can I instruct Biopython to display all the records?
I apologize for not including the code earlier. I am using Python 2.7.9, Biopython 1.66 and Numpy 1.9.1.
First, I'm just counting how many records.
from Bio import SeqIO
filename = "myFileNameHere.fasta"
count = 0
for record in SeqIO.parse(filename, "fasta"):
count = count + 1
print "there are " + str(count) + " records"
Structured this way, it prints that there are 50 records in the file.
But if I put the print statement -- print str(count) -- inside the loop, it prints to the screen a series from 1 to 25 like so
1
2
3
4
.
.
.
24
25
Why does it stop at 25 if there are 50 records in the file?
Next I ask to see the id and length.
for record in SeqIO.parse(filename, "fasta"):
print "record " + record.id + ", length " + str(len(record.seq))
It prints the info, but only 25 records. So I thought, hmmm, only 25 displayed each time I ask for a display? Default limit of 25?

Moving Average across Variables in Stata

I have a panel data set for which I would like to calculate moving averages across years.
Each year is a variable for which there is an observation for each state, and I would like to create a new variable for the average of every three year period.
For example:
P1947=rmean(v1943 v1944 v1945), P1947=rmean(v1944 v1945 v1946)
I figured I should use a foreach loop with the egen command, but I'm not sure about how I should refer to the different variables within the loop.
I'd appreciate any guidance!
This data structure is quite unfit for purpose. Assuming an identifier id you need to reshape, e.g.
reshape long v, i(id) j(year)
tsset id year
Then a moving average is easy. Use tssmooth or just generate, e.g.
gen mave = (L.v + v + F.v)/3
or (better)
gen mave = 0.25 * L.v + 0.5 * v + 0.25 * F.v
More on why your data structure is quite unfit: Not only would calculation of a moving average need a loop (not necessarily involving egen), but you would be creating several new extra variables. Using those in any subsequent analysis would be somewhere between awkward and impossible.
EDIT I'll give a sample loop, while not moving from my stance that it is poor technique. I don't see a reason behind your naming convention whereby P1947 is a mean for 1943-1945; I assume that's just a typo. Let's suppose that we have data for 1913-2012. For means of 3 years, we lose one year at each end.
forval j = 1914/2011 {
local i = `j' - 1
local k = `j' + 1
gen P`j' = (v`i' + v`j' + v`k') / 3
}
That could be written more concisely, at the expense of a flurry of macros within macros. Using unequal weights is easy, as above. The only reason to use egen is that it doesn't give up if there are missings, which the above will do.
FURTHER EDIT
As a matter of completeness, note that it is easy to handle missings without resorting to egen.
The numerator
(v`i' + v`j' + v`k')
generalises to
(cond(missing(v`i'), 0, v`i') + cond(missing(v`j'), 0, v`j') + cond(missing(v`k'), 0, v`k')
and the denominator
3
generalises to
!missing(v`i') + !missing(v`j') + !missing(v`k')
If all values are missing, this reduces to 0/0, or missing. Otherwise, if any value is missing, we add 0 to the numerator and 0 to the denominator, which is the same as ignoring it. Naturally the code is tolerable as above for averages of 3 years, but either for that case or for averaging over more years, we would replace the lines above by a loop, which is what egen does.
There is a user written program that can do that very easily for you. It is called mvsumm and can be found through findit mvsumm
xtset id time
mvsumm observations, stat(mean) win(t) gen(new_variable) end

Resources