MACRO Debug for pivot table - macros

Trying to create a MACRO to run a pivot table and I need help debugging. Here is the script:
Sheets.Add
newsheet = ActiveSheet.Name
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
dataname, Version:=xlPivotTableVersion10). _
CreatePivotTable TableDestination:=newsheet & "!R3C1", TableName:="PivotTable2" _
, DefaultVersion:=xlPivotTableVersion10
Sheets(newsheet).Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable2")
.ColumnGrand = True
.HasAutoFormat = True
.DisplayErrorString = False
.DisplayNullString = True
.EnableDrilldown = True
.ErrorString = ""
.MergeLabels = False
.NullString = ""
.PageFieldOrder = 2
.PageFieldWrapCount = 0
.PreserveFormatting = True
.RowGrand = True
.SaveData = True
.PrintTitles = False
.RepeatItemsOnEachPrintedPage = True
.TotalsAnnotation = False
.CompactRowIndent = 1
.InGridDropZones = True
.DisplayFieldCaptions = True
.DisplayMemberPropertyTooltips = False
.DisplayContextTooltips = True
.ShowDrillIndicators = True
.PrintDrillIndicators = False
.AllowMultipleFilters = True
.SortUsingCustomLists = True
.FieldListSortAscending = False
.ShowValuesRow = True
.CalculatedMembersInFilters = False
.RowAxisLayout xlTabularRow
End With
With ActiveSheet.PivotTables("PivotTable2").PivotCache
.RefreshOnFileOpen = False
.MissingItemsLimit = xlMissingItemsDefault
End With
ActiveSheet.PivotTables("PivotTable2").RepeatAllLabels xlRepeatLabels
With ActiveSheet.PivotTables("PivotTable2").PivotFields("Status")
.Orientation = xlRowField
.Position = 1
End With
ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
"PivotTable2").PivotFields("Status"), "Count of Status", xlCount
End Sub
The error message I receive is run-time error 1004
application-defined or object-declined error
The line that is the issue is below:
.DisplayMemberPropertyTooltips = False
How do I correct? Thanks!!!

Related

getting error 'Keyword "optional" is not a valid type constructor' in terraform with terraform version ">= 0.15"

In the current terraform pipeline, I am passing topics as a list
locals {
test_topics = [
{
name = "topic1"
is_public = true
version = 1
is_cleanup_policy_compact = true
max_message_bytes = "-1"
partition_count = 3
},
{
name = "topic2"
is_public = true
version = 1
is_cleanup_policy_compact = true
max_message_bytes = "-1"
partition_count = 4
},
{
name = "topic3"
is_public = true
version = 1
is_cleanup_policy_compact = true
max_message_bytes = "-1"
partition_count = 5
},
{
name = "topic4"
is_public = true
version = 1
is_cleanup_policy_compact = true
max_message_bytes = "-1"
},
{
name = "topic5"
is_public = true
version = 1
is_cleanup_policy_compact = true
max_message_bytes = "-1"
partition_count = 5
}
]
}
# example create topic it automatically assigns READ WRITE access to the service account and READ access to all PUBLIC topics
module "test_topics" {
source = "../kafka_topic"
topics = "${local.test_topics}"
environment = var.environment
data_domain = var.data_domain
service_account = var.service_account
}
and declaring variables in child modules like below
variable "topics" {
type = list(object({
name = string
is_public = bool
is_cleanup_policy_compact = bool
version = number
max_message_bytes = number
partition_count = number
}))
description = "list of topics with their configuration"
default = null
}
and in child main.tf we are creating the topics using following code
resource "kafka_topic" "topic" {
count = length(var.topics)
name = "${lookup(var.topics[count.index], "is_public") ? "public" :"private"}_${var.environment}_${var.data_domain}_${lookup(var.topics[count.index], "name")}_${lookup(var.topics[count.index], "version")}"
partitions = lookup(var.topics[count.index], "partition_count") == null ? 6 : "${lookup(var.topics[count.index], "partition_count")}"
replication_factor = 3
config = {
"cleanup.policy" = lookup(var.topics[count.index], "is_cleanup_policy_compact") ? "compact" : "delete"
"max.message.bytes" = lookup(var.topics[count.index], "max_message_bytes") != -1 ? "${lookup(var.topics[count.index], "max_message_bytes")}" : 1000012
}
}
but when running terraform plan I am getting following exception
attribute "partition_count" is required.
Note : I also used partition_count = optional(number) in declaring the variable in variable.tf (to keep that attribute as a optional field) but getting following error
Keyword "optional" is not a valid type constructor
as it might be due to the terraform version currently I am using which is ">= 0.12" but when I tried with the ">= 0.15" version, got the same error 'Keyword "optional" is not a valid type constructor' error.
Is there any way I can fix this issue?
Try to add this:
terraform {
experiments = [module_variable_optional_attrs]
}

How to write this piece of code in function?

I am using the "Divergence Indicator" script written by Tradingview with Macd, stoch and rsi at the same time.
I use the code below duplicate 3 times (for Macd, stoch and rsi)
plFound = na(ta.pivotlow(rsi, lbL, lbR)) ? false : true
phFound = na(ta.pivothigh(rsi, lbL, lbR)) ? false : true
// Regular Bullish
oscHL = rsi[lbR] > ta.valuewhen(plFound, rsi[lbR], 1) and _inRange(plFound[1])
priceLL = close[lbR] < ta.valuewhen(plFound, close[lbR], 1)
bullCond = priceLL and oscHL and plFound
// Regular Bearish
oscLH = rsi[lbR] < ta.valuewhen(phFound, rsi[lbR], 1) and _inRange(phFound[1])
priceHH = close[lbR] > ta.valuewhen(phFound, close[lbR], 1)
bear = priceHH and oscLH and phFound
Is it possible to use a function to avoid duplicating the same code 3 times?
Very simple
f_divergences(_src) =>
plFound = na(ta.pivotlow(_src, lbL, lbR)) ? false : true
phFound = na(ta.pivothigh(_src, lbL, lbR)) ? false : true
// Regular Bullish
oscHL = _src[lbR] > ta.valuewhen(plFound, _src[lbR], 1) and _inRange(plFound[1])
priceLL = close[lbR] < ta.valuewhen(plFound, close[lbR], 1)
bullCond = priceLL and oscHL and plFound
// Regular Bearish
oscLH = _src[lbR] < ta.valuewhen(phFound, _src[lbR], 1) and
_inRange(phFound[1])
priceHH = close[lbR] > ta.valuewhen(phFound, close[lbR], 1)
bear = priceHH and oscLH and phFound
[bullCond, bear]
// Calling the function three times
[rsi_bull, rsi_bear] = f_divergences(rsi)
[stoch_bull, stoch_bear] = f_divergences(stoch)
[macd_bull, macd_bear] = f_divergences(macd)

bulk processor "monstache" was unable to perform work: elastic: Error 400 (Bad Request): Validation Failed: 1: type is missing;

I am trying to integrate mongoDB and elasticsearch using monstache but I am facing this error. Please help me solve it out.
I will response with all the output you want.
config.toml file
mongo-url = "mongodb+srv://prince:mypassword#cluster0.mp297.mongodb.net/?retryWrites=true&w=majority"
elasticsearch-urls = ["http://127.0.0.1:9200"]
elasticsearch-max-conns = 10
replay = false
resume = true
enable-oplog = true
resume-name = "default"
namespace-regex = '^Satellite\.posts$'
direct-read-namespaces = ["Satellite.posts"]
change-stream-namespaces = ["Satellite."]
index-as-update = true
verbose = true
exit-after-direct-reads = false
[[mapping]]
namespace = "Satellite.posts"
index = "satellite"

NuSMV stucked for none reason

I'm writing a model in NuSMV. However, there is a problem. When I try to simulate the model in using the interactive mode using ./NuSMV -int, it stucks on a state saying that there is not any further reachable states. But, this should not be true according the way I write the model and the transition from that state. For more information I put here the entire model, the execution trace and the entire last state of the trace.
For the model I put the link of pastebin Model. The intereseted part of the model is the MODULE PI and the transition from the pc = 53 to the pc = 54 in the TRANS section.
This is the trace of the simulation
Trace Type: Simulation
-> State: 13.1 <-
ca.x1 = None
ca.x2 = None
ca.PK = None
ca.x3 = None
ca.len = 0
cb.x1 = None
cb.PK = None
cb.x2 = None
cb.len = 0
IniCommitAB = FALSE
IniRunningAB = FALSE
ResRunningAB = FALSE
ResCommitAB = FALSE
p_initial.PIni_process1.slef = None
p_initial.PIni_process1.party = None
p_initial.PIni_process1.nonce = None
p_initial.PIni_process1.runable = FALSE
p_initial.PIni_process1.g1 = None
p_initial.PIni_process1.pc = 1
p_initial.PIni_process2.slef = None
p_initial.PIni_process2.party = None
p_initial.PIni_process2.nonce = None
p_initial.PIni_process2.runable = FALSE
p_initial.PIni_process2.g1 = None
p_initial.PIni_process2.pc = 1
p_initial.PRes_process.slef = None
p_initial.PRes_process.nonce = None
p_initial.PRes_process.g2 = None
p_initial.PRes_process.g3 = None
p_initial.PRes_process.runable = FALSE
p_initial.PRes_process.pc = 1
p_initial.PI_process.kNa = FALSE
p_initial.PI_process.kNb = FALSE
p_initial.PI_process.k_Na_Nb__A = FALSE
p_initial.PI_process.k_Na_A__B = FALSE
p_initial.PI_process.k_Nb__B = FALSE
p_initial.PI_process.x1 = None
p_initial.PI_process.x2 = None
p_initial.PI_process.x3 = None
p_initial.PI_process.pc = 1
p_initial.PI_process.runable = FALSE
p_initial.pc = 1
cb_is_empty = TRUE
ca_is_empty = TRUE
p_initial.PI_process.x3_I = FALSE
p_initial.PI_process.check = TRUE
-> Input: 13.2 <-
_process_selector_ = p_initial
running = FALSE
p_initial.running = TRUE
p_initial.PI_process.running = FALSE
p_initial.PRes_process.running = FALSE
p_initial.PIni_process2.running = FALSE
p_initial.PIni_process1.running = FALSE
cb.running = FALSE
ca.running = FALSE
-> State: 13.2 <-
p_initial.pc = 2
-> Input: 13.3 <-
-> State: 13.3 <-
p_initial.PIni_process1.slef = A1
p_initial.PIni_process1.party = I
p_initial.PIni_process1.nonce = Na
p_initial.PIni_process1.runable = TRUE
p_initial.pc = 4
-> Input: 13.4 <-
-> State: 13.4 <-
p_initial.PRes_process.slef = B
p_initial.PRes_process.nonce = Nb
p_initial.PRes_process.runable = TRUE
p_initial.pc = 5
-> Input: 13.5 <-
-> State: 13.5 <-
p_initial.PI_process.runable = TRUE
p_initial.pc = 6
-> Input: 13.6 <-
_process_selector_ = p_initial.PIni_process1
p_initial.running = FALSE
p_initial.PIni_process1.running = TRUE
-> State: 13.6 <-
p_initial.PIni_process1.pc = 4
-> Input: 13.7 <-
-> State: 13.7 <-
p_initial.PIni_process1.pc = 5
-> Input: 13.8 <-
-> State: 13.8 <-
p_initial.PIni_process1.pc = 6
-> Input: 13.9 <-
-> State: 13.9 <-
ca.x1 = A1
ca.x2 = Na
ca.PK = A1
ca.x3 = I
ca.len = 1
p_initial.PIni_process1.pc = 7
ca_is_empty = FALSE
-> Input: 13.10 <-
_process_selector_ = p_initial.PI_process
p_initial.PI_process.running = TRUE
p_initial.PIni_process1.running = FALSE
-> State: 13.10 <-
p_initial.PI_process.pc = 52
-> Input: 13.11 <-
-> State: 13.11 <-
ca.x1 = None
ca.x2 = None
ca.PK = None
ca.x3 = None
ca.len = 0
p_initial.PI_process.x1 = Na
p_initial.PI_process.x2 = A1
p_initial.PI_process.x3 = I
p_initial.PI_process.pc = 53
ca_is_empty = TRUE
p_initial.PI_process.x3_I = TRUE
While this is the entire last state of the execution
ca.x1 = None
ca.x2 = None
ca.PK = None
ca.x3 = None
ca.len = 0
cb.x1 = None
cb.PK = None
cb.x2 = None
cb.len = 0
IniCommitAB = FALSE
IniRunningAB = FALSE
ResRunningAB = FALSE
ResCommitAB = FALSE
p_initial.PIni_process1.slef = A1
p_initial.PIni_process1.party = I
p_initial.PIni_process1.nonce = Na
p_initial.PIni_process1.runable = TRUE
p_initial.PIni_process1.g1 = None
p_initial.PIni_process1.pc = 7
p_initial.PIni_process2.slef = None
p_initial.PIni_process2.party = None
p_initial.PIni_process2.nonce = None
p_initial.PIni_process2.runable = FALSE
p_initial.PIni_process2.g1 = None
p_initial.PIni_process2.pc = 1
p_initial.PRes_process.slef = B
p_initial.PRes_process.nonce = Nb
p_initial.PRes_process.g2 = None
p_initial.PRes_process.g3 = None
p_initial.PRes_process.runable = TRUE
p_initial.PRes_process.pc = 1
p_initial.PI_process.kNa = FALSE
p_initial.PI_process.kNb = FALSE
p_initial.PI_process.k_Na_Nb__A = FALSE
p_initial.PI_process.k_Na_A__B = FALSE
p_initial.PI_process.k_Nb__B = FALSE
p_initial.PI_process.x1 = Na
p_initial.PI_process.x2 = A1
p_initial.PI_process.x3 = I
p_initial.PI_process.pc = 53
p_initial.PI_process.runable = TRUE
p_initial.pc = 6
cb_is_empty = TRUE
ca_is_empty = TRUE
p_initial.PI_process.x3_I = TRUE
The problem is that NuSMV stucks on this state. I don't know why, since the condition to step in the next state is that (x3 = I) that is true, in fact p_initial.PI_process.x3_I = TRUE. Moreover, for every simulation it stops at most at the 11th state. These are the command that I give to execute
read_model -i <model>
flatten_hierarchy
encode_variables
build_model
pick_state -r
simulate -r -p -k 12
I know that it is not a simple problem. But I need help, I'm stucked on this problem since weeks.

How to remove the following character "/" from service path

Good Morning!
Currently I have set up my structure in Fiware saving my historical records in MongoDB, for this I have been using Mlab as a hosting.
I attache the configuration file of my agent, the problem comes in that due to the mandatory character "/" of the service path I can not access the generated historical data, since it is a character not allowed for collections in MongoDB.
agent_1.conf
cygnus-ngsi.sources = http-source
cygnus-ngsi.sinks = mongo-sink
cygnus-ngsi.channels = mongo-channel
cygnus-ngsi.sources.http-source.channels = mongo-channel
cygnus-ngsi.sources.http-source.type = org.apache.flume.source.http.HTTPSource
cygnus-ngsi.sources.http-source.port = 5050
cygnus-ngsi.sources.http-source.handler = com.telefonica.iot.cygnus.handlers.NGSIRestHandler
cygnus-ngsi.sources.http-source.handler.notification_target = /notify
cygnus-ngsi.sources.http-source.handler.default_service = default
cygnus-ngsi.sources.http-source.handler.default_service_path = /sevilla
cygnus-ngsi.sources.http-source.handler.events_ttl = 2
cygnus-ngsi.sources.http-source.interceptors = ts
cygnus-ngsi.sources.http-source.interceptors.ts.type = timestamp
cygnus-ngsi.sinks.mongo-sink.type = com.telefonica.iot.cygnus.sinks.NGSIMongoSink
cygnus-ngsi.sinks.mongo-sink.channel = mongo-channel
cygnus-ngsi.sinks.mongo-sink.enable_encoding = false
cygnus-ngsi.sinks.mongo-sink.enable_grouping = false
cygnus-ngsi.sinks.mongo-sink.enable_name_mappings = false
cygnus-ngsi.sinks.mongo-sink.enable_lowercase = false
cygnus-ngsi.sinks.mongo-sink.data_model = dm-by-service-path
cygnus-ngsi.sinks.mongo-sink.attr_persistence = row
cygnus-ngsi.sinks.mongo-sink.mongo_hosts = ds******.mlab.com:35866
cygnus-ngsi.sinks.mongo-sink.mongo_username = my_user
cygnus-ngsi.sinks.mongo-sink.mongo_password = ********
cygnus-ngsi.sinks.mongo-sink.db_prefix = sth_
cygnus-ngsi.sinks.mongo-sink.collection_prefix = sth_
cygnus-ngsi.sinks.mongo-sink.batch_size = 1
cygnus-ngsi.sinks.mongo-sink.batch_timeout = 30
cygnus-ngsi.sinks.mongo-sink.batch_ttl = 10
cygnus-ngsi.sinks.mongo-sink.data_expiration = 0
cygnus-ngsi.sinks.mongo-sink.collections_size = 0
cygnus-ngsi.sinks.mongo-sink.max_documents = 0
cygnus-ngsi.sinks.mongo-sink.ignore_white_spaces = true
cygnus-ngsi.channels.mongo-channel.type = com.telefonica.iot.cygnus.channels.CygnusMemoryChannel
cygnus-ngsi.channels.mongo-channel.capacity = 1000
cygnus-ngsi.channels.mongo-channel.transactionCapacity = 100
Is there any way for Cygnus to remove the "/" character from the service path?
Error: http://www.subirimagenes.com/imagedata.php?url=http://s2.subirimagenes.com/imagen/9827048captura-de-pantalla.png
SOLUTION: You just have to change the enconding to true in the agent configuration
cygnus-ngsi.sinks.mongo-sink.enable_encoding = true
Thank you very much!