Consulta Outra Lista Ajax SharePoint

Consultando em outra lista e montando uma tabela através de AJAX/Jquery SharePoint.

No exemplo abaixo mostro como pesquisar na lista Projetos e exibir em uma div HTML.
Filtro pelo status “Em andamento” e ordeno pela data de criação do item.

[js]
function Projetos(){

var urlSite = _spPageContextInfo.siteAbsoluteUrl;
var obj;
var listaSiteProjetos = “/_api/Web/Lists/getbytitle(‘Projetos’)/items?$skip=2&$top=15&$orderby=Created asc&$filter=Status eq ‘Em andamento'”;
var url = urlSite + listaSiteProjetos;

var tabela = “

“;

$.ajax({
url: url,
type: “GET”,
headers: {“accept”: “application/json;odata=verbose”},
success: function(data){
console.log(data);
obj = data.d.URL;
$.each(data.d.results, function(index, item){
//alert(item.Id + 10);
console.log(item);
tabela += “

“;
});
tabela += “

” + item.Title + “

“;

$(“#projetos”).html(tabela);
},
error: function(error){ alert(JSON.stringify(error)); },
async:false
});
}
[/js]

Até a próxima!

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , , , | Leave a comment

Consultar Lista CAML Query SharePoint

Consultando em outra lista no SharePoint através de CAML Query e JQuery

[js]
function ConsultaListaTarefas() {
var urlSite = _spPageContextInfo.siteAbsoluteUrl;
var clientContext = new SP.ClientContext(urlSite);
var oList = clientContext.get_web().get_lists().getByTitle(‘Tasks’);
var itemId = ‘123’

var urlParaCaml = _spPageContextInfo.webServerRelativeUrl + “/Lists/campanhas/DispForm.aspx?ID=” + itemId;
var camlQuery = new SP.CamlQuery();

var queryXml = “” + urlParaCaml + ““;

camlQuery.set_viewXml(queryXml);

this.collListItem = oList.getItems(camlQuery);

clientContext.load(collListItem);

clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededAprovadores), Function.createDelegate(this, this.onQueryFailed));

}

function onQuerySucceededAprovadores(sender, args) {

var listItemInfo = ”;

var listItemEnumerator = collListItem.getEnumerator();

while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();

listItemInfo += ‘\nID: ‘ + oListItem.get_id() +
‘\nTitle: ‘ + oListItem.get_item(‘Title’) +
‘\nStatus: ‘ + oListItem.get_item(‘Status’) +
‘\nAprovador: ‘ + oListItem.get_item(‘AssignedTo’).get_lookupValue() +
‘\nBody: ‘ + oListItem.get_item(‘Body’);
}

console.log(listItemInfo.toString());
}

// Caso erro
function onQueryFailed(sender, args) {
alert(‘Request failed. ‘ + args.get_message() + ‘\n’ + args.get_stackTrace());
}
[/js]

Até a próxima!

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , , , | Leave a comment

Abrir modal padrão SharePoint 2013

Exemplo de função jQuery para abrir Modal no modelo do SharePoint.

[js]
// Abre o modal do WorkFlow de Aprovação
function AbrirModal(){

var htmlWorkFlows = “

Exemplo de Modal

“;
$(‘body’).append(htmlWorkFlow);

var mdModal = document.getElementById(‘mdModal’);

var options = {
html: mdModal,
width: 500,
height: 400,
allowMaximize:true,
title: ‘Modal Exemplo’,
showClose: true,
};

try {
SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);
}
catch (error) {
ExecuteOrDelayUntilScriptLoaded(AbrirModal, “sp.ui.dialog.js”);
SP.SOD.execute(‘sp.ui.dialog.js’, ‘SP.UI.ModalDialog.showModalDialog’, options);
}
}
[/js]

Você também pode abrir uma página como no exemplo

[js]
function openModalSolicitacao(pageUrl) {
SP.UI.ModalDialog.showModalDialog(
{
url: “/Lists/ListaExemplo/NewForm.aspx”,
width: 500,
height: 500,
allowMaximize:true,
title: “Exemplo de Modal”
}
);
}
[/js]

Até a próxima!

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , | Leave a comment

Converter Campos Formulário SharePoint em Label

Para desabilitar alguns campos do nosso formulário de Inclusão ou Alteração SharePoint 2013 em Label podemos executar a ação abaixo.

[js]
var camposDesabilitar = [‘Title_’, ‘TipoComunicacao_’, ‘Observacoes_’];

for(var tEFields = 0; tEFields < camposDesabilitar.length; tEFields++){
ConvertTextboxToLable(camposDesabilitar[tEFields]);
}

function ConvertTextboxToLable(colName)
{
var txtHTML = $(‘[id^=”‘+ colName +'”]’).val();
var tdColumn = $(‘[id^=”‘+ colName +'”]’).closest(‘td’);
var tdColumnHTML = $(tdColumn).html();

$(tdColumn).html(“<div style=’display:none’>'” + tdColumnHTML + “‘</div>”);
$(tdColumn).append(txtHTML);
}
[/js]

 
Até a Próxima!
 

 

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> JQuery, SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , , | Leave a comment

Desabilitar Segurança do Internet Explorer Windows Server 2012

O Internet Explorer Enhanced Security Configuration (IE ESC) estabelece configurações de segurança que definem como os usuários navegam nos sites da Internet e da intranet.
Essas configurações também reduzem a exposição do seu servidor a sites da Web que possam apresentar um risco de segurança. Não é recomendado desativar a segurança avançada do IE nos servidores do Windows Server 2012 R2 porque pode reduzir a segurança e potencialmente pode expor o servidor aos ataques.

Esse nível aprimorado de segurança pode evitar que os sites da Web sejam exibidos corretamente no Internet Explorer e podem restringir o acesso a recursos de rede, como arquivos em pastas compartilhadas de UNC (Universal Naming Convention).

Se você deseja visualizar um site que requer funcionalidade do Internet Explorer que tenha sido desativado, você pode adicionar o site da Web às listas de inclusão nas zonas de Intranet local ou de sites confiáveis.

Quando o IE ESC está ativado, você recebe pop-up o tempo todo e você é solicitado a adicionar cada nova URL à zona de sites confiáveis do IE.

Se você está ciente da insegurança que você pode estar expondo seu servidor, realize o procedimento abaixo.

  1. Abra o Server Manager
    IE ESC
  2. Clique em Local Server
  3. Localize a opção “IE Enhanced Security Configuration”
  4. Clique em “On”

Atenção, cuidado e Até a próxima!

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> Dicas, Windows | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , | Leave a comment

SharePoint 2013 – Versões – Build Numbers

Abaixo lista de todas as versões do SharePoint 2013.

SharePoint 2013

Build Number

Build Name

Component

Information Link

Download Link

Notes

15.0.4128.1014 Beta SharePoint Foundation 2013 Download Bugs, Notes, & Regressions
15.0.4128.1014 Beta SharePoint Server 2013 Download
15.0.4128.1014 Beta Project Server 2013 Download
​15.0.4420.1017 ​RTM ​​SharePoint Foundation 2013 Download ​Bugs, Notes, & Regressions
​​15.0.4420.1017 ​RTM ​SharePoint Server 2013 Download
​​15.0.4420.1017 ​RTM ​Project Server 2013 Download
​15.0.4433.1506 ​December 2012 Hotfix ​SharePoint Server 2013 KB2752058 Download ​Bugs, Notes, & Regressions
​15.0.4433.1506 ​December 2012 Hotfix ​SharePoint Server 2013 (coreserver) KB2752001 Download
​15.0.4481.1005 ​March 2013 Public Update ​SharePoint Foundation 2013 KB2768000 Download Bugs, Notes, & Regressions
​​15.0.4481.1005 ​​March 2013 Public Update ​SharePoint Server 2013 KB2767999 Download
​​15.0.4481.1005 ​​March 2013 Public Update ​Project Server 2013 KB2768001 Download
​15.0.4505.1002 ​April 2013 CU ​​SharePoint Foundation 2013 KB2751999 Download Bugs, Notes, & Regressions
​15.0.4505.1005 ​​April 2013 CU ​SharePoint Server 2013 KB2726992 Download
​15.0.4505.1005 ​April 2013 CU ​Project Server 2013 KB775426 Download
​15.0.4517.1003 ​June 2013 CU ​SharePoint Foundation 2013 KB2817346 Download Bugs, Notes, & Regressions
​15.0.4517.1005 ​June 2013 CU ​​SharePoint Server 2013 KB2817414 Download
​June 2013 CU ​Project Server 2013 KB2817415 Download
​15.0.4535.1000 ​August 2013 CU ​​SharePoint Foundation 2013 KB2817517 Download Bugs, Notes, & Regressions
​​August 2013 CU ​SharePoint Server 2013 KB2817616 Download
​​August 2013 CU ​Project Server 2013 KB2817615 Download
​15.0.4551.1001 ​October 2013 CU ​SharePoint Foundation 2013 KB2825674 Download Bugs, Notes, and Regressions
​15.0.4551.1005 ​October 2013 CU ​SharePoint Server 2013 KB2825647 Download
​October 2013 CU ​Project Server 2013
​15.0.4551.1508 ​December 2013 CU ​SharePoint Foundation 2013 KB2849961 Download ​Bugs, Notes, and Regressions
​15.0.4551.1511 ​SharePoint Server 2013 KB2850024 Download
​15.0.4551.1508 ​Project Server 2013 KB2837668 Download
​15.0.4569.1000* ​Service Pack 1 ​SharePoint Foundation 2013 KB2817439 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2817429 Download
​Project Server 2013 KB2817434 Download
​15.0.4571.1502* ​Service Pack 1 Mark 2 ​SharePoint Foundation 2013 KB2880551 Download Bugs, Notes, and Regressions
​​ ​SharePoint Server 2013 KB2880552 Download
​​ ​Project Server 2013 KB2880553 Download
​​15.0.4605.1000 ​April 2014 CU ​​SharePoint Foundation 2013 KB2863892 Download ​​Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2878240 Download
​Project Server 2013 KB2880484 Download
​15.0.4615.1001 ​MS14-022 ​SharePoint Foundation 2013 KB2952166 ​Links in KB Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2952166 ​Links in KB
​Project Server 2013 KB2952166 ​Links in KB
15.0.4617.1000 ​June 2014 CU SharePoint Foundation 2013 KB2881063 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2881061 Download
​Project Server 2013 KB2881062 Download
​ 15.0.4631.1001 ​July 2014 CU ​SharePoint Foundation 2013 KB2882999 Download ​​Bugs, Notes, & Regressions
​​SharePoint Server 2013 KB2882989 Download
​Project Server 2013 KB2882990 Download
​15.0.4641.1001 ​August 2014 CU ​SharePoint Foundation 2013 KB2883081 Download Bugs, Notes, & Regressions
​SharePoint Server 2013 (1/5) KB2760213 Download
​​SharePoint Server 2013 (2/5) KB2880559 Download
​​SharePoint Server 2013 (3/5) KB2883078 Download
​​SharePoint Server 2013 (4/5) KB2883085 Download
​​SharePoint Server 2013 (5/5) KB2883086 Download
​Project Server 2013 KB2883083 Download
​15.0.4649.1001 ​September 2014 CU ​SharePoint Foundation 2013 KB2883087 Download Bugs, Notes, & Regressions
​SharePoint Server 2013 KB2883068 Download
​Project Server 2013 KB2883072 Download
​15.0.4659.1001 ​October 2014 CU ​SharePoint Foundation 2013 KB2889946 Download ​​Bugs, Notes, & Regressions
​SharePoint Server 2013 (1/3) KB2899469 Download
​SharePoint Server 2013 (2/3) KB2880962 Download
​SharePoint Server 2013 (3/3) KB2880485 Download
​Documentum Connector KB2752098 Download
​Project Server 2013 KB2889959 Download
​15.0.4667.1000 ​November 2014 CU ​SharePoint Foundation 2013 KB2899468 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2889944 Download
​Project Server 2013 KB2889949 Download
​15.0.4675.1000 ​December 2014 CU ​SharePoint Foundation 2013 KB2910945 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2910938 Download
​Project Server 2013 KB2910911 Download
​15.0.4693.1001 ​February 2015 CU ​​SharePoint Foundation 2013 KB2920801 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2920804 Download
​​Project Server 2013 KB2920796 Download
​15.0.4701.1001 ​March 2015 CU ​SharePoint Foundation 2013 KB2956159 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB2956166 Download
​Project Server 2013 KB2956162 Download
​15.0.4711.1000 ​April 2015 CU ​SharePoint Foundation 2013 KB2965261 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB2965266 Download
​Project Server 2013 KB2965263 Download
​15.0.4719.1002 ​May 2015 CU ​SharePoint Foundation 2013 ​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3039780
​Project Server 2013 KB3039753
​15.0.4727.1001 ​June 2015 CU ​SharePoint Foundation 2013 KB3054864 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3054866 Download
​Project Server 2013 KB3054865 Download
​​15.0.4737.1001 ​July 2015 CU ​SharePoint Foundation 2013 ​Bugs, Notes, and Regressions
​SharePoint Server 2013
​Project Server 2013
​​​15.0.4745.1001 ​August 2015 CU ​​SharePoint Foundation 2013 KB3055004 ​​Bugs, Notes, and Regressions
​SharePoint Server 2013
​​Project Server 2013 Download
​15.0.4753.1000 ​September 2015 CU
SharePoint Foundation 2013
KB2975894 Bugs, Notes, and Regressions
​SharePoint Server 2013
​Project Server 2013
​15.0.4763.1000 ​October 2015 CU ​SharePoint Foundation 2013 KB3085488 Download ​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3085492 Download
​Project Server 2013 KB3085489 Download
​15.0.4771.1000 ​November 2015 CU ​SharePoint Foundation 2013 KB3101368 Download ​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3101373 Download
​Project Server 2013 KB3101369 Download
​15.0.4779.1000 ​​December 2015 CU ​SharePoint Foundation 2013 KB3114339 Download ​​Bugs, Notes, and Regressions​​
​SharePoint Server 2013 KB3114345 Download
​​Project Server 2013 KB3114341 Download
​15.0.4787.1000 ​January 2016 CU ​SharePoint Foundation 2013 KB3114492 Download ​Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013 KB3114497 Download​
​Project Server 2013 KB3114493 Download
​15.0.4797.1000 ​February 2016 CU ​SharePoint Foundation 2013 KB3114722 Download Bugs, Notes, and Regressions​​​​
​​SharePoint Server 2013 KB3114726 Download
​Project Server 2013 KB3114723 Download
​15.0.4805.1000 ​March 2016 CU ​SharePoint Foundation 2013 KB3114822 Download ​​Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013 KB3114827 Download
​Project Server 2013 KB3114823 Download
​15.0.4815.1000 ​April 2016 CU ​SharePoint Foundation 2013 KB3114935 Download Bugs, Notes, and Regressions​​​​
​​SharePoint Server 2013 KB3114938 Download
​​Project Server 2013 KB3114936 Download
​15.0.4823.1003 ​May 2016 CU ​SharePoint Foundation 2013 KB3115023 Download ​Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013 KB3115029 Download
​Project Server 2013 KB3115024 Download
​15.0.4833.1003 ​June 2016 CU ​SharePoint Foundation 2013 KB3115171 Download Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013 KB3115174 Download
​Project Server 2013 KB3115172 Download
​15.0.4841.1000 ​July 2016 CU ​SharePoint Foundation 2013 KB3115290 Download Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013 KB3115293 Download
​Project Server 2013 KB3115291 Download
​15.0.4849.1000 ​August 2016 CU ​SharePoint Foundation 2013 KB3115447 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3115450 Download
​Project Server 2013 KB3115448 Download
​15.0.4859.1000 ​September 2016 CU ​SharePoint Foundation 2013 KB3118271 Download ​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3118279 Download
​Project Server 2013 KB3118274 Download
​15.0.4867.1002 ​October 2016 CU ​SharePoint Foundation 2013 KB3118361 Download ​​​Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB3118366 Download
​Project Server 2013 KB3118365 Download
​15.0.4875.1000 ​November 2016 CU ​SharePoint Foundation 2013 KB3127930 Download ​​​​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3127933 Download
​Project Server 2013 KB3127931 Download
​15.0.4885.1000 ​December 2016 CU ​SharePoint Foundation 2013 KB3128001 Download Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3128005 Download
​Project Server 2013 KB3128003 Download
​15.0.4893.1001 ​January 2017 CU ​SharePoint Foundation 2013 KB3141479 Download Bugs, Notes, and Regressions
​​SharePoint Server 2013 KB3141481 Download
​Project Server 2013 KB3141480 Download
​February 2017 ​No Updates
​15.0.4911.1001 ​March 2017 CU ​SharePoint Foundation 2013 KB3172456 Download ​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3172497 Download
​Project Server 2013 KB3172462 Download
​15.0.4919.1003 ​April 2017 CU ​​SharePoint Foundation 2013​ KB3178727 Download ​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3178730 Download
​Project Server 2013 KB3178725 Download
​15.0.4927.1001 ​May 2017 CU ​​​SharePoint Foundation 2013​ KB3191911 Download ​Bugs, Notes, and Regressions
​SharePoint Server 2013 KB3191913 Download
​​Project Server 2013 KB3191912 Download
​15.0.4937.1001​ ​June 2017 CU ​​​SharePoint Foundation 2013​ KB3203428 Download ​​Bugs, Notes, and Regressions​​
​​SharePoint Server 2013​ KB3203430 Download
​​​Project Server 2013 KB3203429 Download
​15.0.4945.1000 ​July 2017 CU ​SharePoint Foundation 2013​ KB3213563 Download ​Bugs, Notes, and Regressions​​​​
​SharePoint Server 2013​ KB3213569 Download
​Project Server 2013 KB3213566 Download

Bom Trabalho!!

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , | Leave a comment

SharePoint 2013 – Service running under Network Service account

Ao realizar a instalação do SharePoint Foundation 2013 no Windows Server 2012 R2 é comum encontrarmos o erro abaixo…

“Exception: System.ArgumentException: The SDDL string contains an invalid sid or a sid that cannot be translated. sharepoint”

Service running under Network Service account in workgroup environment is not supported SharePoint 2013

Para resolver realize os passos abaixo:

  1. Abra o SharePoint PowerShell
  2. Vá até a pasta C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\BIN
  3. Execute o comando psconfig.exe -cmd Configdb create SkipRegisterAsDistributedCacheHost

O script vai concluir a instalação do SharePoint. Após concluído acesse a Administração Central do SharePoint para testar a solução.

 

Até a próxima.

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SharePoint | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , | Leave a comment

Criar tabela com base em Select MySQL

Por vezes temos a necessidade de criar uma tabela “física” com base em um select, são diversos os motivos um deles é a organização das tabelas do nosso banco.
Para tal realize a ação abaixo

[sql]
CREATE TABLE nome-da-tabela
SELECT * FROM tabela-atual
[/sql]

Obs: lembre-se sempre que o “* from” não é uma boa opção se tratando em performance. Neste caso substitua o * pelo nome dos campos da tabela, até dando nomes aos novos campos caso se faça necessário.

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> MySQL | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , , | Leave a comment

Gerar Query Insert Automaticamente

A procedure abaixo cria query INSERT a partir dos registros de uma tabela no SQL Server.

[sql]

CREATE PROC [dbo].[InsertGenerator]
(@tableName varchar(100)) as

–Declare a cursor to retrieve column specific information
–for the specified table
DECLARE cursCol CURSOR FAST_FORWARD FOR
SELECT column_name,data_type FROM information_schema.columns
WHERE table_name = @tableName
OPEN cursCol
DECLARE @string nvarchar(3000) –for storing the first half
–of INSERT statement
DECLARE @stringData nvarchar(3000) –for storing the data
–(VALUES) related statement
DECLARE @dataType nvarchar(1000) –data types returned
–for respective columns
SET @string=’INSERT ‘+@tableName+'(‘
SET @stringData=”

DECLARE @colName nvarchar(50)

FETCH NEXT FROM cursCol INTO @colName,@dataType

IF @@fetch_status<>0
begin
print ‘Table ‘+@tableName+’ not found, processing skipped.’
close curscol
deallocate curscol
return
END

WHILE @@FETCH_STATUS=0
BEGIN
IF @dataType in (‘varchar’,’char’,’nchar’,’nvarchar’)
BEGIN
SET @stringData=@stringData+””””’+
isnull(‘+@colName+’,””)+”””,”+’
END
ELSE
if @dataType in (‘text’,’ntext’) –if the datatype
–is text or something else
BEGIN
SET @stringData=@stringData+””””’+
isnull(cast(‘+@colName+’ as varchar(2000)),””)+”””,”+’
END
ELSE
IF @dataType = ‘money’ –because money doesn’t get converted
–from varchar implicitly
BEGIN
SET @stringData=@stringData+”’convert(money,”””+
isnull(cast(‘+@colName+’ as varchar(200)),”0.0000”)+”””),”+’
END
ELSE
IF @dataType=’datetime’
BEGIN
SET @stringData=@stringData+”’convert(datetime,”””+
isnull(cast(‘+@colName+’ as varchar(200)),”0”)+”””),”+’
END
ELSE
IF @dataType=’image’
BEGIN
SET @stringData=@stringData+””””’+
isnull(cast(convert(varbinary,’+@colName+’)
as varchar(6)),”0”)+”””,”+’
END
ELSE–presuming the data type is int,bit,numeric,decimal
BEGIN
SET @stringData=@stringData+””””’+
isnull(cast(‘+@colName+’ as varchar(200)),”0”)+”””,”+’
END

SET @string=@string+@colName+’,’

FETCH NEXT FROM cursCol INTO @colName,@dataType
END

DECLARE @Query nvarchar(4000) — provide for the whole query,
— you may increase the size

SET @query =’SELECT ”’+substring(@string,0,len(@string)) + ‘)
VALUES(”+ ‘ + substring(@stringData,0,len(@stringData)-2)+”’+”)”
FROM ‘+@tableName
exec sp_executesql @query –load and run the built query

CLOSE cursCol
DEALLOCATE cursCol

GO

[/sql]

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> SQL | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , , | Leave a comment

Verificar se valor existe na String Javascript

Algumas formas de verificar se valor existe em uma string utilizando JavaScript.

1. (ES6) includes
[js]
var string = “foo”,
substring = “oo”;
string.includes(substring);
[/js]

2. search
[js]
var string = “foo”,
expr = “/oo/”;
string.search(expr);
[/js]

3. lodash includes
[js]
var string = “foo”,
substring = “oo”;
_.includes(string, substring);
[/js]

4. RegExp
[js]
var string = “foo”,
expr = /oo/; // no quotes here
expr.test(string);
[/js]

5. Match
[js]
var string = “foo”,
expr = “/oo/”;
string.match(expr);
[/js]

 

Utilize o recurso console.log para verificar no console do navegador o resultado, exemplo console.log(string.match(expr))

O resultado deve ser true ou false.

<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span> JavaScript | <span class="entry-utility-prep entry-utility-prep-tag-links">Tagged</span> , | Leave a comment