Creating new User Routines in Talend Open Studio - data-migration

I have created a new user routine in Talend Open Studio but I am not able to view the newly created user routine in any of the function lists.

The function will show up if you document your function as javadoc.
Example:
/*****
* helloExemple: Print the hello message on the console
* {Category} xpto
* {talendTypes} String
*
* */
You can see more examples in the project TALENDDEMOJAVAS -> pasta t03_demoroutines -> demo03_tmap

Related

Collection export to Sharepoint list problem in PowerApps

I have a collection (created from Sharepoint list) and I would like to overwrite the original SP list by this collection.
This overwrite should be activated by an exit button after asking if I would like to exit the app.
This is the code I used in the PowerApps:
ForAll(collection; Patch(Leltár_SP_lista; Defaults(Leltár_SP_lista); { 'T$ORNO': orno; 'T$SERN': sern; 'T$CWAR': cwar;'T$LOCA':loca;'T$CPRJ': cprj;
'T$ITEM':item;'T$CNTR': cntr;'T$CLOT':clot;'T$DATE':date;'T$STUN':stun;'T$QSTK':qstk;'T$QSTR':qstr;'T$DATA':data;
'T$TIMA':tima;'T$CSTK': cstk;'T$CSTR':cstr;'T$COUN':coun;'T$PRST': prst;'T$CSTS':csts;'T$DSCA':dsca}))
The main problem is that the pressing of button (which activate this code) doesn't overwrite the Sharepoint list but merges to end of the list.
How should I modify this code to solve my problem?
When you use Defaults() function you create a new record. If you want to overwrite the record you have to refer to the ID with a LookUp function inside the Patch as the second argument. Or you could use a ForAll function with a Remove function before patching. Please tell me if you have problems on doing this
Try:
ForAll(collection;
Patch(
Leltár_SP_lista;
LookUp(Leltár_SP_lista, ID = ThisRecord.ID);
{
'T$ORNO': orno;
'T$SERN': sern;
'T$CWAR': cwar;
'T$LOCA': loca;
'T$CPRJ': cprj;
'T$ITEM': item;
'T$CNTR': cntr;
'T$CLOT': clot;
'T$DATE': date;
'T$STUN': stun;
'T$QSTK': qstk;
'T$QSTR': qstr;
'T$DATA': data;
'T$TIMA': tima;
'T$CSTK': cstk;
'T$CSTR': cstr;
'T$COUN': coun;
'T$PRST': prst;
'T$CSTS': csts;
'T$DSCA': dsca
}
)
)

Getting only the current authenticated user's data from an easy table/view in Azure

Using Microsoft Azure, I've created a database using easy tables (node.js backend). I have several tables and one view.
There's a trick to making the view work like an easy table which I've done.
Problem:
When using this code to read data from the view, I receive ALL data -- including data for other users.
table.read(function (context) {
return context.execute();
});
That makes sense, as I'm not specifying that I only want the authenticated user's data.
When using this code, I get NO data:
// READ operation
table.read(function (context) {
context.query.where({ userId: context.user.id });
return context.execute();
});
Using the above code for an actual table and not a view works perfectly.
From the log files:
2017-01-02T18:52:00.945Z - silly: Executing SQL statement SELECT TOP 3 * FROM [dbo].[ClassData] WHERE (([userId] = #p1) AND ([deleted] = #p2)); with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
2017-01-02T18:52:00.945Z - silly: Read query returned 2 results
sprintf() will be removed in the next major release, use the sprintf-js package instead.
2017-01-02T18:52:01.867Z - silly: Executing SQL statement SELECT TOP 10 * FROM [dbo].[StacksNamesView] WHERE (([userId] = #p1) AND ([deleted] = #p2)) ORDER BY [createdAt]; with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
2017-01-02T18:52:01.883Z - debug: SQL statement failed - Invalid column name 'userId'.: SELECT TOP 10 * FROM [dbo].[StacksNamesView] WHERE (([userId] = #p1) AND ([deleted] = #p2)) ORDER BY [createdAt]; with parameters [{"name":"p1","pos":1,"value":"sid:REMOVED"},{"name":"p2","pos":2,"value":false}]
UPDATE:
When creating Azure App Service EasyTables, the column "userId" is automatically a part of each table. However, it's not visible when looking at the schema via the Azure Portal. This is where my confusion was.
SOLUTION:
When using a view as an EasyTable and you need the "hidden" userId column, just make sure you select it as part of the view! This will work as long as your other EasyTables are executing queries such as the second block of code in this post.

How to select value from a dropdown using JScript (not JavaScript) with TestComplete

Currently I'm working on TestComplete automation tool. I'm facing a problem in selecting a value from a dropdown using Jscript. It can done easily in javascript by
document.getElementById("id").options[1].selected=true
I cant do it using JScript'. I've tried
Browsers.Item(btIExplorer).Run("Page URL"); //opening the browser and running a URL
browser=Aliases.browser; //creating alias of browser object
page=browser.Page("PageURL"); //creating a page object for the page opened
page.NativeWebObject.Find("id", "defaultLocationBinder_newOrExisting", "input") // This is the dropdown
I'm not able to find any suitable option to select the options in the dropdown which are given in the <option></option> tags
I just wrote this piece of code and was able to do it.
Use the selectedIndex to set the option you want.
use the object spy to check the properties/methods you can use with the object.
function loginDropDown()
{
var dropDown = Sys.Browser("iexplore").Page("*").FindChild("Name","Select(\"myList\")",10,true)
dropDown.selectedIndex = 1
}
The NativeWebObject.Find method returns a native object while you may want to work with a TestComplete wrapper. Use the Find or FindChild method to get such a wrapper and the Clickitem method to select a specific item.
function test()
{
var b = Sys.Browser("iexplore");
b.ToUrl("http://support.smartbear.com/message/?prod=TestComplete");
var page = b.Page("http://support.smartbear.com/message/?prod=TestComplete");
var cBox = page.FindChild("ObjectIdentifier", "ddlRequestType", 20);
cBox.ClickItem("General product question");
}

SAS script to list all SAS server users from metadata

I need a way to import a list of all SAS users from SAS metadata into an Excel worksheet. I was considering doing this using the SAS plugin for Microsoft Office to create a dynamic data source the retrieves the list of users dynamically from the SAS server. If I am to do this I need to know how to do this in SAS code.
Does anyone know how I would write a SAS script to display a list of all users in SAS metadata, or if this is even possible?
I've been trying to find something online but haven't had any luck.
I have full administrator privileges, so no problem there.
Thanks!
Thanks to Joe in the comments I found the answer I need:
http://support.sas.com/documentation/cdl/en/lrmeta/63180/HTML/default/viewer.htm#p1k9zipe59ha2an1pq34gu143lay.htm
I used the very last example in this page, modified to do a PROC PRINT instead of exporting to an Excel sheet. In Enterprise Guide I created a new program as follows:
/*Connect to the metadata server using the metadata system options as
shown in the first example. */
data work.Identities;
/* The LENGTH statement defines the lengths of variables for function arguments. */
length IdentId IdentName DispName ExtLogin IntLogin DomainName $32
uri uri2 uri3 uri4 $256;
/* The LABEL statement assigns descriptive labels to variables. */
label
IdentId = "Identity Id"
IdentName = "Identity Name"
DispName = "Display Name"
ExtLogin = "External Login"
IntLogin = "Is Account Internal?"
DomainName = "Authentication Domain";
/* The CALL MISSING statement initializes the output variables to missing values. */
call missing(IdentId, IdentName, DispName, ExtLogin, IntLogin, DomainName,
uri, uri2, uri3, uri4);
n=1;
n2=1;
/* The METADATA_GETNOBJ function specifies to get the Person objects in the repository.
The n argument specifies to get the first person object that is returned.
The uri argument will return the actual uri of the Person object. The program prints an
informational message if no objects are found. */
rc=metadata_getnobj("omsobj:Person?#Id contains '.'",n,uri);
if rc<=0 then put "NOTE: rc=" rc
"There are no identities defined in this repository"
" or there was an error reading the repository.";
/* The DO statement specifies a group of statements to be executed as a unit.
The METADATA_GETATTR function gets the values of the Person object's Id, Name,
and DisplayName attributes. */
do while(rc>0);
objrc=metadata_getattr(uri,"Id",IdentId);
objrc=metadata_getattr(uri,"Name",IdentName);
objrc=metadata_getattr(uri,"DisplayName",DispName);
/* The METADATA_GETNASN function gets objects associated via the
InternalLoginInfo association. The InternalLoginInfo association returns
internal logins. The n2 argument specifies to return the first associated object
for that association name. The URI of the associated object is returned in
the uri2 variable. */
objrc=metadata_getnasn(uri,"InternalLoginInfo",n2,uri2);
/* If a Person does not have any internal logins, set their IntLogin
variable to 'No' Otherwise, set to 'Yes'. */
IntLogin="Yes";
DomainName="**None**";
if objrc<=0 then
do;
put "NOTE: There are no internal Logins defined for " IdentName +(-1)".";
IntLogin="No";
end;
/* The METADATA_GETNASN function gets objects associated via the Logins association.
The Logins association returns external logins. The n2 argument specifies to return
the first associated object for that association name. The URI of the associated
object is returned in the uri3 variable. */
objrc=metadata_getnasn(uri,"Logins",n2,uri3);
/* If a Person does not have any logins, set their ExtLogin
variable to '**None**' and output their name. */
if objrc<=0 then
do;
put "NOTE: There are no external Logins defined for " IdentName +(-1)".";
ExtLogin="**None**";
output;
end;
/* If a Person has many logins, loop through the list and retrieve the name of
each login. */
do while(objrc>0);
objrc=metadata_getattr(uri3,"UserID",ExtLogin);
/* If a Login is associated to an authentication domain, get the domain name. */
DomainName="**None**";
objrc2=metadata_getnasn(uri3,"Domain",1,uri4);
if objrc2 >0 then
do;
objrc2=metadata_getattr(uri4,"Name",DomainName);
end;
/*Output the record. */
output;
n2+1;
/* Retrieve the next Login's information */
objrc=metadata_getnasn(uri,"Logins",n2,uri3);
end; /*do while objrc*/
/* Retrieve the next Person's information */
n+1;
n2=1;
rc=metadata_getnobj("omsobj:Person?#Id contains '.'",n,uri);
end; /*do while rc*/
/* The KEEP statement specifies the variables to include in the output data set. */
keep IdentId IdentName DispName ExtLogin IntLogin DomainName;
run;
/* The PROC PRINT statement writes a basic listing of the data. */
proc print data=work.Identities label;
run;
/* The PROC EXPORT statement can be used to write the data to an Excel spreadsheet. */
/* Change DATA= to the data set name you specified above. */
/* Change OUTFILE= to an appropriate path for your system. */
/*
proc export data=work.Identities
dbms=EXCE
outfile="C:\temp\Identities.xls"
replace;
run;
*/
PROC PRINT DATA=work.Identities;
When this was executed it created a SAS Report. I exported that Report as a .srx file and then used the SAS Plugin for Microsoft Office to add the report into an Excel worksheet (the "Reports" button).
I then right-clicked on the cell where the report was added and clicked Properties, and then set it to automatically update whenever the document is opened.
It's a great way to review users as an administrator. Rather than having to check each system individually to see if a user exists (when they leave the company for example) I have a sheet for each of our SAS systems, a sheet for each of our Teradata systems (auto-updated using a query run through ODBC), and another sheet auto-updated from a separate spreadsheet that contains the list of our MicroStrategy users. It makes checking all systems as simple as a single Ctrl + F.
If you just want to extract the list of users in SAS you can compile this macro and run:
%mm_getusers(outds=myusers)
Disclaimer - I wrote it, and we use it in our commercial product (https://datacontroller.io) so users can see group memberships when applying permissions within the tool.

Full text search in Subsonic

In subsonic v2 I can use inline query for full text search in sql server 2008, like this:
DB.Query().ExecuteTypedList<Product>("select * from Product where contains(*, #order)", queryString);
all this works fine.
But now I would like to move on subsonic v3, so I'm trying to get results through SqlQuery, but ExecuteTypedList return an null reference exception:
SubSonic.Query.SqlQuery inlineQuery = new SqlQuery();
inlineQuery.SQLCommand = string.Format("select * from Product where contains(*, '{0}')", queryString);
return inlineQuery.From("Product").ExecuteTypedList<Product>();
PLease prompt me? how I can execute inline query in subsonic v3, to get List<> not a reader
answer is:
return new CodingHorror(string.Format("select * from Product where contains(*, '{0}')", queryString)).ExecuteTypedList<Product>();

Resources