Add and Merge Two Hash Tables in PowerShell

Chirag Nagrekar
Updated on 26-Feb-2020 10:21:00

4K+ Views

Adding values of the hash table is simple as the adding string. We just need to use the addition operator (+) to merge two hash table values.Here, we have two hash tables: $htable and $htable1.$htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"} $htable1 = [Ordered]@{Fruit='Apple';Color='Red'}We will now add two hash tables,$htable + $htalble1PS C:\WINDOWS\system32> $htable+$htable1 Name       Value ----       ----- EmpName    Charlie City       New York EmpID      001 Fruit      Apple Color      Red

Extract Data from SAP Using .NET Provider

Johar Ali
Updated on 26-Feb-2020 10:18:56

1K+ Views

To extract using SSIS, you need to have access to backend system. You can use .NET connector and write a Windows application that extracts data from SAP system using Function Module.For more details on how to connect SAP using .NET connector, you can refer this blog- https://blogs.sap.com/2013/02/14/connecting-to-sap-with-nco-3/With use of BAPI’s you can allow external applications to access business processes and data in R/3 system. Below code is used to make call to BAPI. First is to create a class that implements IDestinationConfiguration −Imports SAP.Middleware.Connector Public Class ECCDestinationConfig    Implements IDestinationConfiguration    Public Event ConfigurationChanged(ByVal destinationName As String, ByVal args As ... Read More

Clear All Values from Hash Table in PowerShell

Chirag Nagrekar
Updated on 26-Feb-2020 10:18:15

3K+ Views

Hash table in the PowerShell session is created temporarily. It is like a variable, when the session is closed, hash table is deleted automatically. If you want to delete all the values from the hash table at once but retaining the hash table variable, you need to use the Clear() method.We have the hash table below created already.$htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}PS C:\WINDOWS\system32> $htable Name       Value ----       ----- EmpName    Charlie City       New York EmpID      001To clear the above hashtable, $htable.Clear()If you check the hash table data, it won’t display ... Read More

Add and Remove Values to the Hash Table in PowerShell

Chirag Nagrekar
Updated on 26-Feb-2020 10:15:05

19K+ Views

You can add values to the hash table and remove values from the hash tables. To add the values to the hash table, you need to use the below format.$hash[""] = ""We have hash table already created here, $htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}PS C:\WINDOWS\system32> $htable Name       Value ----       ----- EmpName    Charlie City       New York EmpID      001We need to add additional key “Dept” in the above hash table with the value “Technical”.$htable['Dept']="Technical"When you check the output of the above Hashtable, you can see the key-value is appended to the table.PS ... Read More

Loop Through an Array in Java

karthikeya Boyini
Updated on 26-Feb-2020 10:12:36

523 Views

To process array elements, we often use either for loop or for each loop because all of the elements in an array are of the same type and the size of the array is known. Suppose we have an array of 5 elements we can print all the elements of this array as −ExampleLive Demopublic class ProcessingArrays {    public static void main(String args[]) {       int myArray[] = {22, 23, 25, 27, 30};             for(int i=0; i

Difference Between Transient and Volatile in Java

Rishi Raj
Updated on 26-Feb-2020 10:11:11

750 Views

transient: An instance variable is marked transient to indicate the JVM to skip the particular variable when serializing the object containing it.  This modifier is included in the statement that creates the variable, preceding the class or data type of the variable.Examplepublic transient int limit = 55;   // will not persist public int b;   // will persistvolatile: The volatile modifier is used to let the JVM know that a thread accessing the variable must always merge its own private copy of the variable with the master copy in the memory.Accessing a volatile variable synchronizes all the cached copied ... Read More

Using GROUP BY Hour in SAP HANA Table

Prabhas
Updated on 26-Feb-2020 10:10:15

677 Views

You can try this method to convert time to date and hour format −select to_varchar(time, 'YYYY-MM-DD'), hour(time), sum(r_time) as r_time, sum(p_time) as p_time from t1 group by date(time), hour(time) order by to_varchar(time, 'YYYY-MM-DD'), hour(time);You can also try using Series_Round() with a group by clause.select SERIES_ROUND(time, 'INTERVAL 1 HOUR') as time, sum(r_time) as r_time, sum(p_time) as p_time from t1 group by SERIES_ROUND(time, 'INTERVAL 1 HOUR') order by SERIES_ROUND(time, 'INTERVAL 1 HOUR');

Create a Hash Table in PowerShell

Chirag Nagrekar
Updated on 26-Feb-2020 10:09:07

2K+ Views

There are several ways to create a Hash Table in PowerShell. We will discuss here the standard method @{} for creating the Hash Table.Using @{} MethodYou can use @{} method to create a hash table. Key-Value pair is separated with the Semi-Colon (;). You can only add unique keys. Duplicate keys are not accepted.$htable = @{EmpName="Charlie";City="New York";EmpID="001"}OutputName       Value ----       ----- EmpID      001 City       New York EmpName    CharlieHere, you will not get the output in an ordered fashion. To get the ordered output, you need to write [Ordered] ahead ... Read More

What is Hash Table in PowerShell

Chirag Nagrekar
Updated on 26-Feb-2020 10:06:13

629 Views

Hash table in a PowerShell is constructed with the Key-Value combination. Each key has its own value, so to get the value we need to refer the Key. We don’t need numeric indexing like Array to refer values.This is how the hash table looks like.Name       Value ----       ----- EmpName     Charlie City       New York EmpID       001In the hash table creation, keys and values are separated with Semi-colons (;). In the above example, EmpName, City and EmpID are referred as keys while Charlie, New York ... Read More

Difference Between replace and replaceAll in Java

Govinda Sai
Updated on 26-Feb-2020 10:04:59

2K+ Views

The replace method of the String class accepts two characters and it replaces all the occurrences of oldChar in this string with newChar.Exampleimport java.io.*; public class Test {    public static void main(String args[]) {       String Str = new String("Welcome to Tutorialspoint.com");       System.out.print("Return Value :" );       System.out.println(Str.replace('o', 'T'));       System.out.print("Return Value :" );       System.out.println(Str.replace('l', 'D'));    } }OutputReturn Value :WelcTme tT TutTrialspTint.cTm Return Value :WeDcome to TutoriaDspoint.comThe replaceAll() method replaces each substring of this string that matches the given regular expression with the given replacement.Exampleimport java.io.*; ... Read More

Advertisements