Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

connect to tableau

chaitanyaiys
7 - Meteor

connect to tableau

10 REPLIES 10
chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("C:\\Users\\NATHDWAR\\Desktop\\1.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(start_word[i]) + 1, stop = nchar(data$C[start_pos]) - nchar(stop_word[i]) - 1)
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)

chaitanyaiys
7 - Meteor

# Load required libraries
library(readxl)
library(dplyr)

# Read data from Excel files
file1 <- read_excel("path_to_file1.xlsx")
file2 <- read_excel("path_to_file2.xlsx")

# Perform the join based on a common constraint
joined_data <- inner_join(file1, file2, by = "common_column_name")

# common_column_name should be replaced with the actual column name that is common between the two files

# View the joined data
print(joined_data)

chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(start_word[i]) + 1, stop = nchar(data$C[start_pos]) - nchar(stop_word[i]) - 2)
} else if (start_word[i] == "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[stop_pos], start = 1, stop = nchar(data$C[stop_pos]) - nchar(stop_word[i]) - 2)
} else if (stop_word[i] == "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(start_word[i]) + 1, stop = nchar(data$C[start_pos]))
}
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)

chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(start_word[i]) + 1, stop = nchar(data$C[start_pos]) - nchar(stop_word[i]) - 2)
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[stop_pos], start = 1, stop = nchar(data$C[stop_pos]) - nchar(stop_word[i]) - 2)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(start_word[i]) + 1, stop = nchar(data$C[start_pos]))
}
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)

chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(as.character(start_word[i])) + 1, stop = nchar(data$C[start_pos]) - nchar(as.character(stop_word[i])) - 2)
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[stop_pos], start = 1, stop = nchar(data$C[stop_pos]) - 1)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(as.character(start_word[i])) + 1, stop = nchar(data$C[start_pos]))
}
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)

chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(as.character(start_word[i])) + 1, stop = nchar(data$C[start_pos]) - nchar(as.character(stop_word[i])) - 2)
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(data$C[stop_pos], start = 1, stop = nchar(data$C[stop_pos]) - 1)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(data$C[start_pos], start = nchar(as.character(start_word[i])) + 1, stop = nchar(data$C[start_pos]))
}
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)

 

 

now1

chaitanyaiys
7 - Meteor

# Load required library
library(readxl)

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Function to extract values from column "C"
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(as.character(data$C[start_pos]), start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])) - nchar(as.character(stop_word[i])) - 2)
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(as.character(data$C[stop_pos]), start = 1, stop = nchar(as.character(data$C[stop_pos])) - 1)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(as.character(data$C[start_pos]), start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])))
}
}
return(result)
}

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)
print(values)
now 2

chaitanyaiys
7 - Meteor

# Load required libraries
library(readxl)
library(openxlsx)

# Function to extract values from column "C" and include all original columns
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(as.character(data$C[start_pos]), start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])) - nchar(as.character(stop_word[i])) - 2)
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(as.character(data$C[stop_pos]), start = 1, stop = nchar(as.character(data$C[stop_pos])) - 1)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(as.character(data$C[start_pos]), start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])))
}
}
# Create a data frame with all original columns and the extracted values
result_df <- cbind(data, Extracted_Values = result)
return(result_df)
}

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)

# Write data to a new Excel file
write.xlsx(values, "output_file.xlsx")

chaitanyaiys
7 - Meteor

# Load required libraries
library(readxl)
library(openxlsx)

# Function to extract values from column "C" and include all original columns
extract_values <- function(start_word, stop_word, data) {
result <- character(length(start_word))
for (i in seq_along(start_word)) {
if (!is.na(start_word[i]) & !is.na(stop_word[i]) & start_word[i] != "" & stop_word[i] != "") {
start_pos <- which(data$A == start_word[i])
stop_pos <- which(data$B == stop_word[i])
if (length(start_pos) > 0 & length(stop_pos) > 0 & stop_pos > start_pos) {
result[i] <- substr(data$C[start_pos], start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])) - nchar(as.character(stop_word[i])) - 2)
} else {
result[i] <- NA
}
} else if (is.na(start_word[i]) & !is.na(stop_word[i]) & stop_word[i] != "") {
# Get all words before stop word
stop_pos <- which(data$B == stop_word[i])
result[i] <- substr(as.character(data$C[stop_pos]), start = 1, stop = nchar(as.character(data$C[stop_pos])) - 1)
} else if (!is.na(start_word[i]) & is.na(stop_word[i]) & start_word[i] != "") {
# Get all words after start word
start_pos <- which(data$A == start_word[i])
result[i] <- substr(as.character(data$C[start_pos]), start = nchar(as.character(start_word[i])) + 1, stop = nchar(as.character(data$C[start_pos])))
}
}
# Create a data frame with all original columns and the extracted values
result_df <- cbind(data, Extracted_Values = result)
return(result_df)
}

# Read data from Excel file
data <- read_excel("path_to_your_excel_file.xlsx")

# Example usage
start_words <- data$A
stop_words <- data$B
values <- extract_values(start_words, stop_words, data)

# Write data to a new Excel file
write.xlsx(values, "output_file.xlsx")

now 3

Labels