Sum Multiple items if condition met

This is a document library. I’m trying to have calculations in two fields using xslt that will sum the amounts in yellow (first year numbers). I also only want to be able to see one entry for each team. Any suggestions.
graphical representation of what my intent is.

c# – Better way to keep a list of items from a Http Request?

I have a simple web api where each request “item” is stored in a list and thus a list is built without creating a new list per request. I have achieved this via dependency injection , but I want to know if there is a better way to do it?

(ApiController)
(Route("(controller)"))
public class MyController: ControllerBase
{
    private readonly List<string> _items;

    public WeatherForecastController(List<string> items)
    {
        _items = items;
    }

    (HttpPost)
    public ActionResult GetList((FromBody) CustomRequestObject request)
    {
        _items.Add(request.Item);

        return Ok(new CustomResponseObject(){Items = _items});
    }
}

public class CustomRequestObject
{
    public string Item { get; set; }
}

public class CustomResponseObject
{
    public IList<string> Items { get; set; }
}

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddControllers();
        services.AddSingleton<List<string>>(); //items stored after each request
    }

    //rest of startup methods left for simplicity
}

pathfinder 1e – Does anyone know where I can find a list of wonderous items by caster level?

A convenient, easy-to-sort, free, quick-loading database of wondrous items that’s organized by caster level may exist somewhere, but this reader suspects that such a database won’t be of much help

It sounds like the issue here is the belief that a magic item’s listed caster level is a requirement for the magic item’s creation. In fact, this is not typically the case: The Pathfinder SRD on Magic Item Creation, in part, says “A creator can create an item at a lower caster level than her own, but never lower than the minimum level needed to cast the needed spell (that’s required to create the magic item).” Hence only those magic items that have a caster level as an actual requirement for their creation require the creator to possess that caster level; other magic items can be created so as to possess a caster level anywhere from the minimum caster level needed to cast the spells required for their creation to the caster’s actual level. (However, note that creating a magic item at lower, nonstandard caster level may affect the magic item’s performance.)

For example, a cape of the mountebank that normally has a caster level 9 can be created by a level 7 wizard who’s capable of providing the cape‘s required dimension door spell because having caster level 9 is not a requirement for the cape‘s creation! When that wizard 7 creates that cape, that cape has both a minimum and a maximum caster level of 7. (Such a cape‘s range—and perhaps capacity—would be similarly altered by this lowered caster level to a degree that would make it inferior to a typical, off-the-rack cape of the mountebank, by the way.) However, a typical ioun stone has as one its requirements that the creator actually possess a caster level of 12, making that requirement fixed and—without bypassing that requirement by increasing the Spellcraft skill check needed to create the item—inescapable.

In sum, a list of wondrous items that themselves possess a caster level of 7 or less doesn’t actually give you a definitive picture of what wondrous items your PC can create. However, a list of wondrous items that includes their spell requirements would.

Note: I can’t vouch for the completeness or usability of this database (last updated Dec. 2017) nor this database (last updated Mar. 2014)— both of which are massive and take a long time to load—but they seem like the kinds of thing that might be of help.

json formatting – How to display past list items related to a column value?

In order to display a custom hover card, you need to use customCardProps element. See more details here. It has the following properties:

openOnEvent

  • hover – card appears on mouse hover;
  • click – card appears on click on the field.

directionalHint

  • topCenter bottomCenter leftCenter rightCenter
  • isBeakVisible – boolean. if true the card has a beak.

enter image description here

Sample JSON

{
    "elmType": "div",
    "txtContent": "@currentField.title",
    "customCardProps": {
        "openOnEvent": "hover",
        "directionalHint": "rightCenter",
        "isBeakVisible": true,
        "formatter": {
            "elmType": "div",
            "style":{ "display": "block", "font-size": "15px", "padding": "10px" },
            "children": [
                {
                    "elmType": "div",
                    "style": { "display": "block", "width":"100%", "text-align": "center", "padding": "10px" },
                      "children":[
                        {"elmType": "div", "txtContent":"Jour 1: 11-05-2021"},
                        {"elmType": "div", "txtContent":"Jour 2: 12-05-2021"},
                        {"elmType": "div", "txtContent":"Jour 3: 13-05-2021"},
                        {"elmType": "div", "txtContent":"Jour 4: 14-05-2021"}
                      ]
                   
                }
            ]
        }
    }
}

In your case, you will have to create a new multiline field that would include all this information. Then, you can create a Power Automate flow that is responsible for populating this new field automatically.

This way, your JSON formula will simply need to reference a single field to display correct content.

You can make your card as fancy as you want. For example:

enter image description here

Cognito Forms: Selecting Individual Items From an Array

I have created an array, using the .Split() functionality, I would like to now reference each item (it I believe) in that array, specifically.

How do I achieve that?


The rest of this you don’t need to read, but I’ll try to provide more information.

I am now going to use an example of something that I might like to do, this is not literally all I want to do.

So. Let’s say a user has input the following data in to the ‘Inputta‘ field:

aaa#bbb#ccc#ddd#eee#fff

Now, in the ‘Arraya‘ field, I have:

Inputta.Split('#')

Let’s say I would like to select the “ddd” entry in that array, how would I do that?

I’ve tried using the .Where() functionality, eg: “.Where(ItemNumber = 4)“, but even if that did work (it doesn’t), it would be no use for if I need to be iterative.

I’ve tried to play with the .Select() functionality, but that’s not helpful, either, as I can’t find decent information on how it even works.


So, on to that iterative tip, to build on this example, I have a secondary requirement of the form, which is to pick an item from the array from an incremented integer.

We’ll imagine I know how to increment an integer, and have that information already, either in a separately generated .Split() field, or as an integer calculation in a Repeating Section.

How would I use the integer to find the array entry in the ‘Arraya‘ field?

Basically, how would I select item 1 (from the second array), then item 2, etc?

This isn’t a separate question, I’m just explaining further the requirement.


As an addendum, I’d love to know how to create an array of incremental integers leading to a pre-determined max number. 😉


For the record, I have StartPaged this thoroughly.

  1. I can’t find a full reference chart for the functions available anywhere online.
  2. The list on CF only lists a subset of the available functions (for example, the .Select() array functionality is not listed)
  3. Everywhere else appears to handle other specific functions.

None of that is stated to cast any disdain anywhere, purely to indicate that I have looked, perhaps my StartPage Fu is just not that strong. Either way, apologies for asking here.

sharepoint online – CAML query is returning all the list items

I have the following CAML query

CamlQuery camlQuery = new CamlQuery();
camlQuery.ViewXml = "<Query><Where><Eq><FieldRef Name='RiskRequestID'/><Value Type='Text'>" + r.id + "</Value></Eq></Where></Query>";
ListItemCollection oListItems = context.Site.RootWeb.GetList(UFSsiteUrl + "Lists/RiskManagement/").GetItems(camlQuery);
context.Load(oListItems);
context.ExecuteQuery();

to get the item with the entered RiskRequestID.. currently instead of getting one item i am getting all the items inside the list.. any advice?

and the RiskRequestID is a SharePoint field of type Single Line of text.

SQL JOIN QUERY with more than one items in common: Find the franchise pairs that operate together in more than one location

With this R script, I have a table called dfmt that lists the location, revenue and franchise. I want to find the franchise pairs that operate together in more than one location.

set.seed(43)
f<-c(   'hilton',
        'marriot',
        'redroofinn',
        'motel 6',
        'holiday inn',
        'best western',
        'raddison',
        'daysinn',
        'howard Johnson',
        'econolodge')
towns<-c('Camden','Washington','New York',
 'Baltimore','Richmond','Miami','Fort Myers','Austin',
 'Dallas','Houston','Chicago','Cleveland','Rochestor',
 'Pheonix','Tempe','Tampa','Augusta','Atlanta','Boston',
 'Stamford','Denver','Fargo','Jacksonville','Savannah',
 'Charleston','Elon','Raleigh','Greensburgh','Gatlingburg',
 'Morgantown','Wheeling','Pittsburgh','Scranton','Binghamton',
 'Syracuse','Manchester','Portland','San Jose')
mtdset<-
lapply(f,FUN=function(x,ptowns=towns)
{
N<-sample(1:length(ptowns),1)
loc<-sample(ptowns,N,rep=F)
rev<-1000*sample(100:1000,N,rep=F)
#paste(x,loc,rev,sep=',')
dfv<-data.frame(loc=loc,rev=rev)
dfv<-cbind(dfv,fr=x)
})
dfmt<-mtdset((1))
for(x in 2:length(mtdset)){
 dfmt<-rbind(dfmt,mtdset((x)))
 }
dim(dfmt)
head(dfmt)
tail(dfmt)

So far, I have a query that finds the franchise pairs that operate in the same location:

select T1.fr, T2.fr2 from dfmt T1 join (select fr as fr2, loc as 
loc2 from dfmt) as T2 on T1.fr < T2.fr2 and T1.loc = T2.loc2 order by loc;

I do not know how to go from here to find the franchise pairs that operate together in only more than one location.

How to NOT print items in an Ansible loop error without no_log

When I execute an ansible module with a loop that has dictionaries with values to be used by the module, including confidential information, I can hide it using loop_control.label, but not when an error happens.

- ansible.module:
    arg1: "{{ item.name }}"
    arg2: "{{ item.some_value }}"
    arg3: "{{ item.secret }}"
    arg4: "{{ item.throw_error }}"
  loop: 
    - name: "item1"
      some_value: "my value"
      secret: "p4$$w0rd"
  loop_control:
    label: "{{ item.name }}"

I can hide it using no_log: true, but it then hides everything, including when a sucess happens, as well as the error message, that could be perfectly fine, and making me clueless about the actual error when I don’t see it.

This is similar to stop all logs in a reverse proxy, or log everything, including authorization headers, both of which are far from desired in a production environment.

So, is there a way to make it not log the loop items when an error occurs, but log everything else? It could be either a task flag, just like no_log, or some global configuration, to include in the ansible.cfg file.

I can’t seem to retrieve SharePoint 2013 list items via Powershell

I have a short script which is going to be part of a larger one but I can’t get it to work. It works on every other list I’ve tried running it against but not this one in particular. The $myList.ItemCount returns the correct number of list items as 4987 but the $items.Count returns 0 and the foreach loop returns no results. Anyone ever deal with this issue? I’m sure it has something to do with the list itself as I made a template of it, copied it to another site, ran the exact same script with the updated url and it worked.

Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue 

$myWeb = Get-SPWeb "https://mysiteurl.org"
$myList = $myWeb.Lists("My List")
$myView = $myList.Views("All Items")
$items = $myList.GetItems($myView)

Write-Output $myList.ItemCount
write-output $items.Count

foreach($item in $items)
{
Write-Output $item
}

Any help would be greatly appreciated.

event observer – Not able to get parent_item_id for cart items retrieved from Order – Magento 2.3.5

I’m trying to get parent_item_id but it is returning null for all simple child products.

    $order = $observer->getEvent()->getOrder();
    $items = $order->getAllVisibleItems();
    foreach ($items as $item) {
            $itemsData() = (
                'name' => $item->getName(),
                'sku' => $item->getSku(),
                'quote_item_id' => $item->getQuoteItemId(),
                'parent_item_id' =>$item->getParentItemId(),
                'qty_ordered' => $item->getQtyOrdered(),
                'product_type' => $item->getProductType(),
                'weight' => $item->getWeight(),
                'price' => $item->getPrice()
            );        
    }

I’m getting all item attributes in my $itemsData array except parent_item_id, though I’ve 4 children of a Bundle product and 1 child of a configurable product in Cart.

I’m doing it in sales_order_place_before observer. I tried getAllItems() and getItems() as well but no luck. Also confirmed from database, parent_item_id exists there for quote_item_id, but just not able to retrieve via getter method.