E newvalues ​​ItemUpdating

I can't figure out how to count values from column with a dropdown list where multiple values can be selected

2020.07.14 05:55 ThaUniversal I can't figure out how to count values from column with a dropdown list where multiple values can be selected

I have a column which contains a drop down list with three values. The values are words or multiple words: "Single" or "Double Trouble" for example. Multiple values can be selected in the same cell, however no values can be repeated in that cell. Thus it can appear as follows:

Row Column A
1 Value 1, Value 2
2 Value 2
3 Value 3, Value 1
4 Value 1, Value 2, Value 3

In a separate tab I then want to count the number of times each Value is selected in 'Column A':

Value Total of Values
Value 1 3
Value 2 3
Value 3 2

The normal count functions do not work. When I cannot select multiple values using the drop down my count formula looks like this: =COUNTIF('Worksheet1'!E4:E16,Worksheet2!A2).
I have tried using different excel functions, a pivot table, and I have tried updating the VBA code, but I can't get anything to work. Does anyone have any idea of what I am missing? I have been searching everywhere to get more information, but I can't even figure out what I am supposed to be searching for.
Here is what I am using to create the drop down:
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Target.Address = "$C$2" Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ", " & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
Sorry that the formatting is all weird. (Source))

Any help with how to do this or good resources where I can teach myself more about functions like this (I'm going to be using this and similar functions a lot for the documents I am trying to create), would be much appreciated.

Thanks.
submitted by ThaUniversal to excel [link] [comments]


2020.03.12 03:38 atdonsm SwiftUI Combine for .onReceive notifications with AVPlayer

I'm working in SwiftUI and have an AudioPlayer type that is a subclass of AVPlayer; it publishes AVPlayer's timeControllerStatus(?) (.playing, .paused, and others?). Rather than subclassing AVPlayer, I would like to pass in an AVPlayer and have it notify me using .onReceive in some View. Here is the current, functional type I have:
import AVKit import Combine class AudioPlayer: AVPlayer, ObservableObject { @Published var buffering: Bool = false override init() { super.init() registerObservers() } private func registerObservers() { self.addObserver(self, forKeyPath: "timeControlStatus", options: [.old, .new], context: nil) } override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { if keyPath == "timeControlStatus", let change = change, let newValue = change[NSKeyValueChangeKey.newKey] as? Int, let oldValue = change[NSKeyValueChangeKey.oldKey] as? Int { let oldStatus = AVPlayer.TimeControlStatus(rawValue: oldValue) let newStatus = AVPlayer.TimeControlStatus(rawValue: newValue) if newStatus != oldStatus { DispatchQueue.main.async {[weak self] in if newStatus == .playing newStatus == .paused { self?.buffering = false } else { self?.buffering = true } } } } } } 
And here is an example of a class like the one I would like (taken from Chris Mash's tutorial on SwiftUI & AVPlayer):
import Combine import AVFoundation class PlayerItemObserver { let publisher = PassthroughSubject() private var itemObservation: NSKeyValueObservation? init(player: AVPlayer) { // Observe the current item changing itemObservation = player.observe(\.currentItem) { [weak self] player, change in guard let self = self else { return } // Publish whether the player has an item or not self.publisher.send(player.currentItem != nil) } } deinit { if let observer = itemObservation { observer.invalidate() } } } 
Your help is much appreciated.
UPDATE:
I got helped here!
submitted by atdonsm to SwiftUI [link] [comments]


2019.07.07 13:53 BrianBoyko [Vue-Function-Api] My thoughts - posted to the RFC on github

Thought I'd like to get /Vuejs 's thoughts on this.

I'm going to be honest - I think this[the new functionapi] is, overall, a better way to do things than the original object/this based way of 1.0, and better than the decorators of Vue 2.0; not that I mind either.
I wrote a styleguide for Vue 1.0 for my old company, it got a 230 stars on github. I'm going to try to come up with a new styleguide that will do the best to reduce fears of "spaghettificatification"
One of the issues that I think people might have with the code is that prior versions. out of necessity, required computed values to be placed in the "computed" property, methods in the "method" property, state in the "data()" method, etc. This contains everything in the setup() so the fears are that these different things will be out of control.
So, I have a couple of questions.
1) When would it be appropriate to use value() instead of state() or vice versa? That is, is there a reason to prefer: const first = value(1); const second = value(2); const third = value(3) over const valueState = state({first: 1, second: 2, third: 3})
If state and value do pretty much the same thing, then I think the code's redundant, if there are key differences, the code might be a little confusing.
Question 2: Can state/value be used with Immutable.js data types?
I'm a little worried about how changes will be triggered with the "state" function. Specifically, will the app only update when the memory address of the original state has changed? (The way JS works, an object with a mutated property is still considered the same object, because the underlying pointer, i.e., memory address, hasn't changed.) So I'm wondering how that change would be triggered, specifically, and what would change. If a change occurs on a state mutation (and not on a state replacement,) then does the entire state - and all computeds and watchers based on properties of that state - rerender?
Question 3: Would it affect performance (or not work correctly) any if a user did something like this?
``` import { value, computed } from 'vue-function-api';
const buildStates = () => ({ todo: value(""), items: value(["Vue", "is", "Awesome"]) }) const buildStates = () => ({ name: state({ firstName: "", lastName: "", middleNames: [] }) }) const buildComputeds = (values, states) => { const lengthOfTodo = computed(() => values.todo.value.length); const numberOfItems = computed(() => values.items.value.length); const fullName = computed(() = { if(states.name.middleNames.length === 0){ return ${states.name.firstName} ${states.name.lastName} } return ${states.name.firstName} ${states.name.middleName.join(' ')} ${states.name.lastName} }) return { lengthOfTodo, numberOfItems, fullName } } const buildMethods = (values, states, computeds) => { const handleField = (event) => { values.todo.value = event.target.value; } const handleAdd = () => { values.items.value = values.items.value.concat(values.todo.value) } const logComputeds = () => console.log(computeds.lengthOfTodo, computed.numberOfItems) const handleName = (nameField) => (event) => { states.name[nameField] = event.target.value; } return { handleField, handleAdd, handleName, logComputeds } } export default { setup() { const values = buildValues(); const states = buildStates(); const computeds = buildComputeds(values, states) const methods = buildMethods(values, states, computeds); return { ...values, ...states, ...computeds, ...methods } }; `` Question 4:
The one area where I would really like to see a change in the syntax of Vue would be in the assignments of the data. I think it's an improvement to have something like: todo.value = newValue rather than todo = newValue; I understand what's going on behind the scenes, todo.value contains a setter which executes the observable code under the surface. And I understand that that syntax is what brings a lot of people to Vue.
But would it be possible to add methods called "setValue" to {value} and setState to {state} which effectively calls the setter directly? That is - so that this syntax: todo.setValue(newValue) would be valid Vue syntax?
Hear me out on this - one of the big things that I find that new Vue programmers struggle with is the principle of least surprise. It is incredibly easy to write Vue code because of the use of observables, but it is incredibly hard to read the vue code because a lot of the chain of events is implicit, not explicit. With the fact that observables trigger changes, when you have multiple programmers of varying ability all programming in different styles, the result can be debugging "spooky action act a distance."
(This is compounded with watchers, but the advice in my styleguide will be: "Use watchers VERY, VERY, VERY sparingly.)
So... adding a setState()/getState() and setValue()/getValue() syntax would be, in my opinion, the preferred way of changing the value of an observable, as the user can clearly see that it is a method that has been executed, and not just a variable reassignment. This is especially true considering that with the new syntax, observable values can be declared, imported, exported from anywhere, passed as props, etc. This is the one thing I think React did right - the setState() method is known to trigger not only a reassignment but also a re-render, i.e., a recomputation of the rendering values, and because of those magic "()" in the syntax, you know the program is doing something.
This might go down like a lead balloon with the Vue community, but I think at least an optional plugin to disable modifying the setter directly and add a setValue() method on value and setState() on state would be great for writing cleaner, easier to understand code. I may fork vue-function-api to do just that.
submitted by BrianBoyko to vuejs [link] [comments]


2019.04.21 00:34 alexherman_rdt [codereview] rudimentary Change Tracking

The code produces SQL UPDATE statement dynamically.

Program.cs
using System; using System.Collections.Generic; using System.Reflection; namespace change_tracking { class Program { static void Main(string[] args) { var resultSet = new Dictionary(); resultSet.Add("Id", "5"); resultSet.Add("Name", "Ford"); resultSet.Add("Description", "DescriptionFord Motor Company is an American multinational automaker that has its main headquarter in Dearborn, Michigan, a suburb of Detroit. It was founded by Henry Ford and incorporated on June 16, 1903. The company sells automobiles and commercial vehicles under the Ford brand and most luxury cars under the Lincoln brand."); var brand = new Brand(); foreach (var item in resultSet) { PropertyInfo propertyInfo = brand.GetType().GetProperty(item.Key); propertyInfo.SetValue(brand, Convert.ChangeType(item.Value, propertyInfo.PropertyType), null); } var oldBrand = brand.DeepCopy(); brand.Description = "description changed"; brand.Name += "D"; // tracking changes string updateStatement = string.Empty; var properties = typeof(Brand).GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (propertyInfo.CanRead) { object newValue = propertyInfo.GetValue(brand, null); object oldValue = propertyInfo.GetValue(oldBrand, null); if (!object.Equals(newValue, oldValue)) { if (!updateStatement.Contains("UPDATE")) { updateStatement += $"UPDATE {typeof(Brand).Name} SET "; } if (updateStatement.Contains("=")) { updateStatement += ", "; } updateStatement += $"{propertyInfo.Name} = '{newValue.ToString()}'"; } } } if (!string.IsNullOrEmpty(updateStatement)) { updateStatement += $" WHERE Id = {oldBrand.Id}"; } Console.WriteLine(updateStatement); Console.ReadKey(); } } } 
IEntity.cs
namespace change_tracking { public interface IEntity { T Id { get; set; } } } 
Entity.cs
namespace change_tracking { public class Entity : IEntity { public T Id { get; set; } } } 
Brand.cs
using System; using System.Runtime.Serialization; namespace change_tracking { public class Brand : Entity { public string Name { get; set; } public string Description { get; set; } } } 
Extensions.cs
using Newtonsoft.Json; using System; namespace change_tracking { public static class Extensions { public static T DeepCopy(this T source) { if (Object.ReferenceEquals(source, null)) { return default(T); } var deserializeSettings = new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }; return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(source), deserializeSettings); } } } 
submitted by alexherman_rdt to csharp [link] [comments]


2019.01.18 21:29 NicBda Totalling results of multiselect drop down

Hello all, I hope you can help. I am working on a spreadsheet to track clients in a program I run. Part of the sheet has Data Verification Lists with VBA code to allow users to select multiple options. I would like to be able to tally the selections separately.
The lists are in columns S (19), V(22), and Y(25)
Using V as the example (shortened the list for example purposes of the post) Data is in V5:V14 (range)

Program Outcome
participating, compliant
Participating, non-compliant
Completed, Compliant
TOTALS
Participating
Not Participating
Compliant
Non-Compliant
Completed

My Code
 Private Sub Worksheet_Change(ByVal Target As Range) 'Code by Sumit Bansal from https://trumpexcel.com ' To allow multiple selections in a Drop Down List in Excel (without repetition) Dim Oldvalue As String Dim Newvalue As String Application.EnableEvents = True On Error GoTo Exitsub If Target.Column = 22 Or Target.Column = 25 Or Target.Column = 19 Then If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then GoTo Exitsub Else: If Target.Value = "" Then GoTo Exitsub Else Application.EnableEvents = False Newvalue = Target.Value Application.Undo Oldvalue = Target.Value If Oldvalue = "" Then Target.Value = Newvalue Else If InStr(1, Oldvalue, Newvalue) = 0 Then Target.Value = Oldvalue & ", " & Newvalue Else: Target.Value = Oldvalue End If End If End If End If Application.EnableEvents = True Exitsub: Application.EnableEvents = True End Sub 
I'd like it to tally/count the "Compliant" "Participating" etc. on the separate lines below
Currently when I enter a formula it allows me to enter it, but then the cell defaults to "0" and the formula is deleted from the cell
Also the cells in S and V (but it works fine in Y) with multiple selections give an [ ! ] pop-up box with "The value in this cell is invalid or missing" Display Data Type shows:
V5
Data Type: List
Restriction:Value Must Match on of the listed items
Blanks will be ignored and are automatically valid.

This will be used near daily to update on what is happening with clients and to track other info in a similar way (hoping to be able to take a formula and copy/paste to the other totals areas).

Also if you could let me know how to change the code to allow me to select an item again to remove it from the list that would be awesome!


Thank you in advance to all who try to help!

submitted by NicBda to excel [link] [comments]


2018.03.14 00:00 Toboe_Irbis Problems with updating bugs and showing list of bugs

I can't list bugs in MC bugtracker. Also I tried to update affected versions of my bug and this SQL error occured telling that there's problem with space: Exception occurred: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: while inserting: [GenericEntity:ChangeItem][newvalue,16610][field,Version][oldstring,null][newstring,Minecraft 18w11a][id,1324900][fieldtype,jira][oldvalue,null][group,876081] (SQL Exception while executing the following:INSERT INTO public.changeitem (ID, groupid, FIELDTYPE, FIELD, OLDVALUE, OLDSTRING, NEWVALUE, NEWSTRING) VALUES (?, ?, ?, ?, ?, ?, ?, ?) (ERROR: could not extend file "base/61607/62382": No space left on device Hint: Check free disk space.))
submitted by Toboe_Irbis to Mojira [link] [comments]


2016.09.28 10:38 shrawan20104132 How to update Title of Custom RightNavigation bar Right Button ?

 buttonName = UIButton()// right bar button //display Price buttonName.frame = CGRect(x: 0, y: 0, width: 65, height: 22) buttonName.backgroundColor = UIColor.clear buttonName.layer.borderWidth = 1 buttonName.layer.borderColor = UIColor.init(hexValue: 0x1abc9c).cgColor buttonName.setTitle(ModelData.textData, for: UIControlState()) buttonName.setTitleColor(UIColor.white, for: UIControlState()) buttonName.titleLabel?.font = Fonts.ralewayRegularFont(14)//UIFont.systemFontOfSize(14) buttonName.addTarget(self, action: #selector(HomeController.handleTap), for: .touchUpInside) 
//rightButtonItemOutlet is right button Navigation Outlet
self.rightButtonItemOutlet.customView = buttonName
func updateHomePageData() {
 print( " ** updated Model \(ModelData.textData) " ) DispatchQueue.main.async { self?.buttonName.setTitle(ModelData.textData, for: UIControlState()) self?.buttonName.setNeedsLayout() self?.buttonName.setNeedsDisplay() } 
Title value is updated if I keep breakpoint at function updateHomePageData() ""po self?.buttonName.titleLabel.text"" i.e newValue , but the value is not changing in UI in right navigation Bar i.e Display's Right barbutton title is still OldValue.
Here UIControlState() === .normal
Thanks.
submitted by shrawan20104132 to iOSProgramming [link] [comments]