Erro no Insert: There are more columns in the insert statement than values specified in the values clause

Quando vou dar um insert buscando dados a partir de outra tabela, esse erro é retornado, o que pode estar de errado com a query ?

INSERT INTO dbo.CRMRAT (IDCRMRAT, CODCOLIGADA, STATUS, TIPO, IDCRMCLIENTE, IDCRMCOLABORADOR, IDCRMPROJETO, DATA, HORAINICIO, HORAFIM, INTERVALO, KMDESLOCAMENTO, VALORPEDAGIO, VALORALIMENTACAO, VALORHOTEL, VALORESTACIONAMENTO, OUTRASDESPESAS, OBSERVACAO, USUARIOCRIACAO, DATACRIACAO, USUARIOALTERACAO, DATAALTERACAO, IDCRMFATURA, DATAFATURAMENTO)     VALUES ((SELECT MAX(IDCRMRAT) + 1 AS IDCRMRAT FROM CRMRAT ) , (SELECT CODCOLIGADA, STATUS, TIPO, IDCRMCLIENTE, IDCRMCOLABORADOR, IDCRMPROJETO, DATA, HORAINICIO, HORAFIM, INTERVALO, KMDESLOCAMENTO, VALORPEDAGIO, VALORALIMENTACAO, VALORHOTEL, VALORESTACIONAMENTO, OUTRASDESPESAS, OBSERVACAO, USUARIOCRIACAO, DATACRIACAO, USUARIOALTERACAO, DATAALTERACAO, IDCRMFATURA, DATAFATURAMENTO             FROM dbo.CRMRAT2 WHERE IDCRMRAT = 11 )) 

Erro apresentado:

inserir a descrição da imagem aqui

Using values from Lookup (Count)

I am struggling to use a value from another list. I have a lookup to a count related on a custom list to determine the number of projects per client. To be able to create a unique project number for each new project, I am trying to use that count related with a workflow to do something simple like the (count related)+1 = NextProjectNumber. I have everything else figured out except how to extract that value from the Count related.

I have tried workflows to copy to a text field, number, integer, … but nothing works. If I change my workflows to reference a field which has a value of 5 (for example) they are working perfectly but it just copying that Count Related field which I am struggling with.

I am a bit of a sharepoint novice so I may be doing things completely wrong.

My WF is something along the lines of

Set Variable 1 to Current List:Projects(Count Related) Do calculation variable 1 + 1 (set as:variable 2) Set Current List:Next Project Number to Variable 2.

Any assistance would appreciated.

Can a workflow populate values in a lookup field for all the items in the list?

I have a list called Contacts, with 4000+ entries. It currently has a dropdown choice column with four specified values for different offices (MAO, NHO, MEO and CTO). I want to convert this dropdown choice column to a lookup column that links to a newly created list with the four offices in it. The reason for this is because I want to use Mark Rackley’s cascade dropdowns to filter Contacts by office.

From what I understand you can’t directly convert a Choice field to a lookup field. So I thought I’d just create a new lookup field that links to the new list with the offices. The problem is there are already 4000+ items in this list that would need to have the applicable office chosen in this new lookup field.

Is there a way to create a workflow that will look at the value in the choice field and then select the matching value in the new lookup field for all the contacts? For example, it sees MAO in the choice field and then selects MAO under the new lookup field.

Datasets and Time values: Filtering and Plotting

After struggling for a few weeks, I have accumulated a few examples of challenging date-related operatations with datasets. Some I have partial solutions; others I cannot yet do. The resources on Datetime objects in datasets is thin on here (both are relatively new to Mathematica, so no surprise), so maybe this will fill in that gap.

For all of my data, we have events that occur at a datetime. We want to understand how the progress on given days compare; for example, when did task A occur on April 4, 2017 vs October 12, 2018? What is the distribution for Task A occurring throughout a day over 100 days?

  1. How can I plot a DateHistogram with a bin of, say, 20 minutes? I can do it by hour: DateHistogram[dataset, "Hour", DateReduction->"Day"]

  2. How can I utilize the DateHistogram plot style using the operator form? A relatively new functionality allows the syntax dataset[plotstyle,"Key"] (see this nice StackExchange thread). For example, I can implement:

    dataset[Groupby[Key["State"]] /* (PieChart[#, ChartLabels->Keys[#]]&), Length]

    I want to use this syntax with DateHistogram; I can implement the most basic version:

    dataset[DateHistogram,"Sent"]

    I want to add the DateReduction option, along the lines of:

    dataset[DateHistogram["Hour",DateReduction->"Day"],"Sent"]

    Unfortunately, the above example doesn’t work and I can’t find more documentation.

  3. How can I select objects in a certain time window? I figured out a method, but perhaps there is a more elegant solution. In the below example, I can plot the events that occur before 2016:

    eventsBefore2016 = dataset[Select[#Sent<DateObject[{2016,1,1}]&,"Sent"]; DateHistogram[eventsBefore2016,"Hour",DateReduction->"Day"]

    Can I make these two lines into one line of code, for example? Could I do it using the operate form (question 2)?

  4. How can I adapt a DistributionChart for a dataset of Datetime values? I don’t example starter code for this one.

(Apologies for the generic code examples below; I can’t share the actual data and my workplace blocks the tutorial datasets such as titanic. If this is a real sticking issue I can adapt this question with a tutorial dataset later at home.)

SharePoint 2013 -Compare values in list to see if all column values match- dashboard

I want to create a dashboard indicating when all items in a list are equal to “Yes”. For testing I am innerHtmling Done/Not Done. The logic seems to work , but I am afraid the code is testing the list as a whole and not the individual items. I am using choice columns.

Am I missing a loop?

$  (document).ready(function() {     arrayIn_OutItems();     

});

function arrayIn_OutItems(){ var siteUrl = “https:xxx/_api/web/lists/GetByTitle(‘listName’)/items?$ select=”Title,Office,HR,Accounting; var array = []

$  .ajax({     url: siteUrl,     type: "GET",     async: false,     headers: {         "accept": "application/json;odata=verbose"     },     success: function (data) {         array = data.d.results;         console.log(array);         var isYes =          for(var i = 0;array[i].length < 0;i++{             array.every(function (e) {       return e  == "Yes"       });         }         if(isYes == true){           document.getElementById('yes/no').innerHTML = "Done";         }else{           document.getElementById('yes/no').innerHTML = "Not Done";         }      },     error: function (err) {         console.log(err);     } }); 

}

Should setters only set values?

I always like to overthink things, so here’s my thought of the day:

Should setters only set the values of class properties, and not perform any other logic?

Suppose I have a class

class User {     private:        int age;        bool is_alive;      public:        int GetAge();        void SetAge();        bool GetIsAlive();        void SetIsAlive(); }; 

When calling User::SetAge(5), one would assume that user.age == 5. But what about User::GetIsAlive()? Should setting the age of the user also perform internal logic to set the is_alive property, or should that be up to the user of the class?

Should it only do exactly what the function says?

void User::SetAge(int age){     this->age = age; } 

or add additional operations?

void User::SetAge(int age){     this->age = age;     this->is_alive = (age < 100); } 

Should it be more explicit?

void User::DetermineIsAlive(){     this->is_alive = (age < 100); } 

Obviously this is a simple case, but in my real world examples, doing something like setting the enabled state of a class (Device.SetState(false)) may then shut down sub components, update the status, etc..

I’m just curious if we think setters should ONLY set values or properties, and multi-statement functions should be more explicit in their naming.