I have an array variable "Names" with this values for example ["Unity","Block","PRD","Monit"] and want to get each of them value into a new variable.
The output desired would be something like:
Variable Group = Unity
Variabel Test = Block
(...)
As this is an array i thought a basic Names[0] would give me the first value and so on for 1,2,3,etc, but on a logic app I can't figure out how that works.
Is this possible?
Thanks
You do know select value from an array have to specific the index, just don't know how to use variable expression.
Use variables('variable_name') get the variable value and then add the parameter [index] behind it to select the value you want. Just like the below picture shows.
Related
I have the following nested struct:
hole 1x200 struct, diam 1x12 struct, which has the following fields: pos, freq1, fre12
That is:
hole(1 to 200).diam(1 to 12).pos
.freq1
.freq2
From a value (freq1 and freq2), I would like to obtain the field name of the struct. So I will need to find the value that matches with freq1 and freq2 and show the fieldname.
I tried to use structfun in order to apply a function to each field.
[struct.field]=structfun(#(x) find(x.freq1==27.059783995484867 & freq2==76.468355874897000))
But I guess I am writing something wrong on the code.
Also I create an anonymous fuction but I have the following error:
'Error using structfun / Inputs to STRUCTFUN must be scalar
structures'
. How ever when I verified if an specific value of the struct is scalar, I have a positive answerd: isscalar(hole(130).diam(10))
I belive I more near the solution using this script:
myfun=#(yourarray,desiredvalue) yourarray==desiredvalue;
%//Apply function to each field of scalar structure, it SCALAR??
desiredfieldindex=myfun(structfun(#(x) x,hole),26.697046257785030)
desiredFieldName=fNames(desiredFieldIndex)
I don´t know if I am in the rigth path, or I should utilize the function find. ALso I that case I don´t know how to implement it.
Couple of things.
FLOATING POINT VALUES! Careful!! Never compare a floating point value as val==0.3! do abs(val-0.3)<10^-8 or something similar. Read more here.
You are using structfun wrong. The function needs 2 arguments, and you are just passing 1! However, structfun will apply a function to each field so you are not using it rigth either in that sense. Lets see an example
example:
a.hithere=5;
a.notthis=3;
fun=#(x)x==5;
[isfive]=structfun(fun,a)
isfive =
1
0
As you can see, it applies the function to each of them. If you try to change the function to fun=#(x)x.hithere==5 you will get an error! As the function is applied to each field, and x.hithere.hithere or x.notthis.hithere do not exist.
If you want to check both values, you will need to check them independently making two separated calls to structfun or avoiding structfun and just making a for loop.
I have define array value in multiple select value drop down but when we submit the form it is showing multiple array value error.
Please advice.
Use the serialize() function to serialize all the inputs in one value
$this->request->data['Model']['multiple'] = serialize($this->request->data('Model.multiple'));
and if you want to retrieve data use unserialize() to get your array as it saved .
For this purpose I do array_implode in the beforeValidate function, and array_explode in the afterFind function.
ShoppingProductCard get all value when i expand it look like
In this i want to get value of all items(Quantity,fkproductID etc) in variable.
please help
Im not 100% sure what the problem is
Dim ID as Integer
ID = shoppingProductsCart(CartID).fkFrequencyAutoshipTypeID
is this what you wanted? (CartID in your Case would be 0)
I would like to delete all invalid URLs of an array. (e.g. v.1.1, version1.2.00, the.area.0a)
var myArray:Array = new Array("v.1.1", "example.com", "www.example.com","http://example.com","version1.2.00","http://www.example.com","the.area.0a","http://example.com/helloworld123");
How to do that?
I think there are 2 parts of the problem. One is that you want to filter your array. It would create a new array, but you can assign the return from filter back to myArray. The function that you pass to filter function can use String.match to match whatever type of regular expression you deem fit for a valid url (this matching is the second part of the problem).
Can you do this? The list filter I want to use looks like this:
Expression Operator Value
=Code.GetOccCat(Fields!accountnumber.Value) = =1
No dice. Basically, it acts like that function returns null as far as the filter is concerned, but when I take the filter off and put the exact same function call in a text box within the list, it returns what it's supposed to return. Can you just not do this, or what am I missing?
Edit: here's the function, completely simple:
Public Function GetOccCat(ByVal AccountNum As Integer) As Integer
Return OccCat(AccountNum)
End Function
OccCat is a public array of integers that is filled via an earlier function call. Again, the correct values display if I just put this in a text box, so the array is verified to be filling up correctly.
Edit: the array gets populated by way of a list at the top of the report. The list repeats on accountnumber with no filter. Inside the list is a textbox containing this code:
=Code.SetOccupancy(Fields!accountnumber.Value, First(Fields!new_total_hours.Value)/First(Fields!new_capacity.Value))
And here's that function:
Public Function SetOccupancy(ByVal AccountNum As Integer, ByVal Occ As Double) As String
Occupancy(AccountNum) = Occ
Select Occ
Case Is > .85
OccCat(AccountNum) = 1
Case .7 to .849
OccCat(AccountNum) = 2
Case .4 to .699
OccCat(AccountNum) = 3
Case Is < .4
OccCat(AccountNum) = 4
End Select
Return ""
End Function
FWIW, I've also tried this filter based on the Occupancy array (being > .85 in this case) and gotten the same result.
Could you show your function in your code?
I just checked it, and it certainly works to filter off of custom code. Though I didn't use yours exactly because I don't quite understand what you are trying to filter by.
Which field are you wanting to filter by?
I think you are just putting your code for your expression in the wrong place. Basically, put the field you want to filter by in the expression box that drops down. Then place your =code.getocccat(my value) in the value expression.
Try this and let me know, but it certainly works. I think you have the placement a little off.