PowerQuery - Add file name as a column - excel

I'm new to PQ
We are working in a retail environment. For each promotional event, multiple employees work on an excel template and forecast for their SKUs.
I'm trying to merge forecast excel files from multiple employees to get a simple Sku resume.
So for each file, I built a loading template making it ready to merge in the master query.
So far that's fine.
The only thing I'm trying to achieve is to add the file name as a custom column for reference.
Heres the simple code I have for each forecast file.
Source = Excel.Workbook(File.Contents("C:\Users\aproulx\J.E. Mondou\Promotions - Rapport Logistique Template Alex\12 DÉCEMBRE\Estimés_circulaire_décembre_2020_Gen.xlsx"), null, true),
EXPORT_Sheet = Source{[Item="Estimés",Kind="Sheet"]}[Data],
#"Premières lignes supprimées" = Table.Skip(EXPORT_Sheet,4),
#"En-têtes promus" = Table.PromoteHeaders(#"Premières lignes supprimées"),
#"Colonnes renommées" = Table.RenameColumns(#"En-têtes promus",{{"Lift", "Lift_PC_MAG"}, {"Estimés (PC)", "Estimés_PC_MAG"}, {"Estimés ($)", "Estimés_$_MAG"}, {"Lift_1", "Lift_PC_WEB"}, {"Estimés (PC)_2", "Estimés_PC_WEB"}, {"Estimés ($)_3", "Estimés_$_WEB"}, {"Lift PC Chaine", "Lift_PC_CHAINE"}, {"Quantités Promo Est. (PC)", "Estimés_PC_CHAINE"}, {"Ventes promos Est. (S)", "Estimés_$_CHAINE"}, {"Marges Promos Est. ($)", "Estimés_MARGES_$_CHAINE"}}),
#"Colonnes supprimées" = Table.RemoveColumns(#"Colonnes renommées",{"Commentaires/#(lf)Comments", "Évènement/#(lf)Event", "Date début/#(lf)Start date", "Date fin/#(lf)End Date", "Nombre de jour promo", "Description de la promotion/#(lf)Promotion description", "Bonus Buy", "Type de promotion", "Texte SAP", "Description WAK", "# WAK", "Carreau", "Groupe #(lf)d'acheteur", "Groupe d'autorisation", "Ancien #(lf)Mondou Code", "Statut toutes chaînes", "Valeur#(lf)visibilité", "Fournisseur/#(lf)Supplier", "#", "Devise/#(lf)Currency", "Emplacement/#(lf)Position", "Frais de visibilité payé/#(lf)Paid visibility fee", "Option du menu promotionnel/#(lf)Promotionnal menu option", "Frais de menu promotionnel/#(lf)Promotionnal menu fee", "# Accord MP", "Allocation sur ventes/#(lf)Sales allowance ($)", "# Accord", "Allocation sur ventes/#(lf)Sales allowance (Pt câlin/Cuddle points)", "# Accord CÂLIN", "Allocation sur achats/#(lf)Off invoice", "Confirmation", "Rabais #(lf)Promotionnel", "Coûtant #(lf)Promotionnel", "Prix de vente #(lf)Promotionnel", "Marge #(lf)Promotionnelle (%)", "Coûtant de base #(lf)Régulier", "Coûtant net #(lf)Régulier", "Prix de vente#(lf)Régulier", "Marge #(lf)Régulière (%)", "Ventes régulières/Semaine#(lf)(moy. 12 dernières semaines)", "Baseline", "% Web", "Ventes régulières/Semaine#(lf)(moy. 12 dernières semaines)_4", "Baseline_5", "Quantités Reg. (PC)", "Ventes Reg. ($)", "Marges Reg. ($)", "Quantités Lift (PC)", "Ventes Lift ($)", "Marges Lift ($)", "Quantités Lift (%)", "Ventes Lift (%)", "Marges Lift (%)", "Estimés à 0", "Estimés dans rapport logistique", "Identiques?", "Groupe de Marchandise", "Marque", "% SKU", "% G.D.M / MARQUE", "% G.D.M", "3 PREM NIVEAUX", "AVG", "écart-type", "Magasin", "Entrepôt", "Column81"}),
#"Lignes filtrées" = Table.SelectRows(#"Colonnes supprimées", each ([Mondou Code] <> null))
in
#"Lignes filtrées"```
Thanks so much for the help

Would something like this work?
See FileName in the first line defined and assigned as a variable
Then it's concat with the file path
At the end, it's added as a custom column
It's untested.
Let me know if it works.
let
FileName = "Estimés_circulaire_décembre_2020_Gen.xlsx",
Source = Excel.Workbook(File.Contents("C:\Users\aproulx\J.E. Mondou\Promotions - Rapport Logistique Template Alex\12 DÉCEMBRE\" & FileName), null, true),
EXPORT_Sheet = Source{[Item="Estimés",Kind="Sheet"]}[Data],
#"Premières lignes supprimées" = Table.Skip(EXPORT_Sheet,4),
#"En-têtes promus" = Table.PromoteHeaders(#"Premières lignes supprimées"),
#"Colonnes renommées" = Table.RenameColumns(#"En-têtes promus",{{"Lift", "Lift_PC_MAG"}, {"Estimés (PC)", "Estimés_PC_MAG"}, {"Estimés ($)", "Estimés_$_MAG"}, {"Lift_1", "Lift_PC_WEB"}, {"Estimés (PC)_2", "Estimés_PC_WEB"}, {"Estimés ($)_3", "Estimés_$_WEB"}, {"Lift PC Chaine", "Lift_PC_CHAINE"}, {"Quantités Promo Est. (PC)", "Estimés_PC_CHAINE"}, {"Ventes promos Est. (S)", "Estimés_$_CHAINE"}, {"Marges Promos Est. ($)", "Estimés_MARGES_$_CHAINE"}}),
#"Colonnes supprimées" = Table.RemoveColumns(#"Colonnes renommées",{"Commentaires/#(lf)Comments", "Évènement/#(lf)Event", "Date début/#(lf)Start date", "Date fin/#(lf)End Date", "Nombre de jour promo", "Description de la promotion/#(lf)Promotion description", "Bonus Buy", "Type de promotion", "Texte SAP", "Description WAK", "# WAK", "Carreau", "Groupe #(lf)d'acheteur", "Groupe d'autorisation", "Ancien #(lf)Mondou Code", "Statut toutes chaînes", "Valeur#(lf)visibilité", "Fournisseur/#(lf)Supplier", "#", "Devise/#(lf)Currency", "Emplacement/#(lf)Position", "Frais de visibilité payé/#(lf)Paid visibility fee", "Option du menu promotionnel/#(lf)Promotionnal menu option", "Frais de menu promotionnel/#(lf)Promotionnal menu fee", "# Accord MP", "Allocation sur ventes/#(lf)Sales allowance ($)", "# Accord", "Allocation sur ventes/#(lf)Sales allowance (Pt câlin/Cuddle points)", "# Accord CÂLIN", "Allocation sur achats/#(lf)Off invoice", "Confirmation", "Rabais #(lf)Promotionnel", "Coûtant #(lf)Promotionnel", "Prix de vente #(lf)Promotionnel", "Marge #(lf)Promotionnelle (%)", "Coûtant de base #(lf)Régulier", "Coûtant net #(lf)Régulier", "Prix de vente#(lf)Régulier", "Marge #(lf)Régulière (%)", "Ventes régulières/Semaine#(lf)(moy. 12 dernières semaines)", "Baseline", "% Web", "Ventes régulières/Semaine#(lf)(moy. 12 dernières semaines)_4", "Baseline_5", "Quantités Reg. (PC)", "Ventes Reg. ($)", "Marges Reg. ($)", "Quantités Lift (PC)", "Ventes Lift ($)", "Marges Lift ($)", "Quantités Lift (%)", "Ventes Lift (%)", "Marges Lift (%)", "Estimés à 0", "Estimés dans rapport logistique", "Identiques?", "Groupe de Marchandise", "Marque", "% SKU", "% G.D.M / MARQUE", "% G.D.M", "3 PREM NIVEAUX", "AVG", "écart-type", "Magasin", "Entrepôt", "Column81"}),
#"Lignes filtrées" = Table.SelectRows(#"Colonnes supprimées", each ([Mondou Code] <> null)),
Output = Table.AddColumn(#"Lignes filtrées", "File name", each FileName)
in
Output

Related

keep or display French letters in VBA script

I am trying to create a VBA script that contain a certain text in French, it actually works well on my MacBook with the Lucida Grande font but since this font doesn't exist on windows the macro does not work in it and whenever I change the font to any one that could support French language it neither delete the characters or replace them with insignificant ones, a part of the code is below, please if some one have the answer i will be so grateful. thank you.
For i = 2 To LRow
' colonne E "."
index = WorksheetFunction.Match(".", Sheets("DATA_1").Range("1:1"), 0)
If Cells(i + 1, index).Value = "" Then
Cells(i + 1, index).EntireRow.Delete
End If
'colonne K "Quelle était votre situation professionnelle 6 mois après l'obtention de votre titre (mois de février) ? "
index = WorksheetFunction.Match("Quelle était votre situation professionnelle 6 mois après l'obtention de votre titre (mois de février) ?", Sheets("DATA_1").Range("1:1"), 0)
If Cells(i + 1, index).Value = "" Then
Cells(i + 1, index).EntireRow.Delete
End If

how to display many questions in a GUI jess application

I want to make a diagnostic GUI application; i m new in jess. i wrote the Jess in action's book but when i run the code i have just the first question and answer it's like it don't register the answer. i found the error in my code but i didn't see.here is my final code i moved some questions to not make it more code here. i have no code error just that it's doesn't display all the questions like i specified in the rules.What could be my error?
(import javax.swing.*)
(import java.awt.*)
(import java.awt.event.*)
;; Don't clear defglobals on (reset)
(set-reset-globals FALSE)
(defglobal ?*crlf* = "
")
;; Question and answer templates
(deftemplate questions
(slot ident)
(slot type)
(slot texte)
(multislot valid))
(deftemplate reponses
(slot texte)
(slot ident))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Module app-rules
(defmodule interview)
(defrule MAIN::questions_basique_1
(declare (auto-focus TRUE))
=>
(assert (ask age)))
(defrule MAIN::questions_basique_2
(declare (auto-focus TRUE))
=>
(assert (ask poids)))
(defrule MAIN::questions_basique_3
(declare (auto-focus TRUE))
=>
(assert (ask symptome_majeur_1)))
(defrule MAIN::questions_basique_4
(declare (auto-focus TRUE))
=>
(assert (ask symptome_majeur_1)))
;; Engine rules
;;questions pour le corps etrangé
(defrule MAIN::request-dyspné_oui
;; si le patient a une dyspnée
(reponses (ident symptome_majeur_1) (texte ?i&:(eq (str-compare ?i yes)0)))
=>
;;lui posée la question si elle est brute
(assert (ask dypnée_brute)))
(defrule MAIN::request-dyspné_brute_oui
(declare (auto-focus TRUE))
;; si le patient a une dyspnée brute
(reponses (ident dypnée_brute) (texte ?i&:(eq (str-compare ?i yes)0)))
=>
;;poser la question sur syndrome de penetration
(assert (ask syndrome_penetration)))
(defrule MAIN::request-syndrome_penetration_oui
(declare (auto-focus TRUE))
;; si le patient a eu syndrome de pénétration
(reponses (ident syndrome_penetration) (texte ?i&:(eq (str-compare ?i yes)0)))
=>
;;poser la quetion sur des rales sibilants unilatérauxé
(assert (ask rales_sibilant_uni)))
(defrule MAIN::request-rales_sibilant_uni_oui
(declare (auto-focus TRUE))
;; s'il a des rales sibilants unilatéreaux
(reponses (ident rales_sibilant_uni) (texte ?i&:(eq (str-compare ?i yes)0)))
=>
;;faire une radio du thorax pour définir s'il ya difference de clarté
(assert (ask Rx_diff_clarte)))
(defrule MAIN::request-Rx_diff_clarte_oui
(declare (auto-focus TRUE))
;; s'il a des differences de clarté
(reponses (ident Rx_diff_clarte) (texte ?i&:(eq (str-compare ?i yes)0)))
=>
;;faire une bronchoscopie
(assert (ask Bronchioscopie)))
;; fin de l'interview
;;début du diagnostique
(defrule MAIN::Corps-etrange
(declare (auto-focus TRUE))
(MAIN::reponses(ident dypnée_brute)(texte yes))
(MAIN::reponses(ident syndrome_penetration)(texte yes))
(MAIN::reponses(ident rales_sibilant_uni)(texte yes))
(MAIN::reponses(ident Rx_diff_clarte)(texte yes))
(MAIN::reponses(ident Bronchioscopie)(texte yes))
=>
(assert recommend-action "Corps etrangé")(halt))
;; Results output
(deffunction recommend-action (?action)
"Give final instructions to the user"
(call JOptionPane showMessageDialog ?*frame*
(str-cat "I recommend that you " ?action)
"Recommendation"
(get-member JOptionPane INFORMATION_MESSAGE)))
(defadvice before halt (?*qfield* setText "Close window to exit"))
;; Module ask
(defmodule ask)
;;poser une question et retourner une reponse
(deffunction ask-patient (?question ?type ?valid)
"Set up the GUI to ask a question"
(?*qfield* setText ?question)
(?*apanel* removeAll)
(if (eq ?type multi) then
(?*apanel* add ?*acombo*)
(?*apanel* add ?*acombo-ok*)
(?*acombo* removeAllItems)
(foreach ?item ?valid
(?*acombo* addItem ?item))
else
(?*apanel* add ?*afield*)
(?*apanel* add ?*afield-ok*)
(?*afield* setText ""))
(?*frame* validate)
(?*frame* repaint))
;;vérifier si la reponse est bien oui ou non
(deffunction is-of-type (?answer ?type ?valid)
"Check that the answer has the right form"
(if (eq ?type multi) then
(foreach ?item ?valid
(if (eq (sym-cat ?answer) (sym-cat ?item)) then
(return TRUE)))
(return FALSE))
(if (eq ?type number) then
(return (is-a-number ?answer)))
;; plain text
(return (> (str-length ?answer) 0)))
(deffunction is-a-number (?value)
(try
(integer ?value)
(return TRUE)
catch
(return FALSE)))
(defrule ask::ask-question-by-id
"Given the identifier of a question, ask it"
(declare (auto-focus TRUE))
(MAIN::questions (ident ?id) (texte ?text)
(type ?type)(valid $?valid))
(not (MAIN::reponses (ident ?id)))
(MAIN::ask ?id)
=>
(ask-patient ?text ?type ?valid)
((engine) waitForActivations))
(defrule ask::collect-user-input
"Check and optionally return an answer from the GUI"
(declare (auto-focus TRUE))
(MAIN::questions (ident ?id) (texte ?text) (type ?type)(valid ?valid))
(not (MAIN::reponses (ident ?id)))
?user <- (user-input ?input)
?ask <- (MAIN::ask ?id)
=>
(if (is-of-type ?input ?type ?valid) then
(assert (MAIN::reponses (ident ?id) (texte ?input)))
(retract ?ask ?user)
(return)
else
(retract ?ask ?user)
(assert (MAIN::ask ?id))))
;; Main window
(defglobal ?*frame* = (new JFrame "Assistant Diagnostique en pneumonie pédiatrique"))
(?*frame* setDefaultCloseOperation (get-member JFrame EXIT_ON_CLOSE))
(?*frame* setSize 700 700)
(?*frame* setVisible TRUE)
;; Question field
(defglobal ?*qfield* = (new JTextArea 5 40))
(bind ?scroll (new JScrollPane ?*qfield*))
((?*frame* getContentPane) add ?scroll)
(?*qfield* setText "Please wait...")
;; Answer area
(defglobal ?*apanel* = (new JPanel))
(defglobal ?*afield* = (new JTextField 40))
(defglobal ?*afield-ok* = (new JButton OK))
(defglobal ?*acombo* = (new JComboBox (create$ "yes" "no")))
(defglobal ?*acombo-ok* = (new JButton OK))
(?*apanel* add ?*afield*)
(?*apanel* add ?*afield-ok*)
((?*frame* getContentPane) add ?*apanel* (get-member BorderLayout SOUTH))
(?*frame* validate)
(?*frame* repaint)
(deffunction read-input (?EVENT)
"An event handler for the user input field"
(assert (ask::user-input (sym-cat (?*afield* getText)))))
(bind ?handler (new jess.awt.ActionListener read-input (engine)))
(?*afield* addActionListener ?handler)
(?*afield-ok* addActionListener ?handler)
(deffunction combo-input (?EVENT)
"An event handler for the combo box"
(assert (ask::user-input (sym-cat (?*acombo* getSelectedItem)))))
(bind ?handler (new jess.awt.ActionListener combo-input (engine)))
(?*acombo-ok* addActionListener ?handler)
(deffacts MAIN::question-data
"questions posée par le systeme"
(questions (ident poids) (type number)(texte "quel poids a-t-il?")(valid))
(questions (ident age) (type number)(texte "quelle age a l'enfant?")(valid))
(questions (ident symptome_majeur_1) (type multi)(texte "presente t-il des dyspnées sifflantes?")(valid yes no))
(questions (ident symptome_majeur_2) (type multi)(texte "presente t-il une toux chronique?")(valid yes no))
(questions (ident dypnée_brute) (type multi)(texte "la dyspnée est-elle brusque?")(valid yes no))
(questions (ident rale_sibilant) (type multi)(texte "a-t-il des rales sibilants?")(valid yes no))
(questions (ident syndrome_penetration) (type multi)(texte "y a t-il eu syndrome de pénétration?")(valid yes no))
(questions (ident rales_sibilant_uni) (type multi)(texte "a t-il/elle des rales sibilants unilatéraux?")(valid yes no))
(questions (ident Rx_diff_clarte) (type multi)(texte "la radio du thorax presente t-elle une difference de clarté des deux champs pulmonaires?")(valid yes no))
(questions (ident Bronchioscopie) (type multi)(texte "la Bronchioscopie montre t-elle un corps étrangé?")(valid yes no))
(ask poids))
(reset)
(run-until-halt)
Throw out all (defmodule ...)
Remove all MAIN:: and ask::.
Delete all (declare (auto-focus TRUE)).
Don't use (return) in any right hand side code.
In short, don't use modules and (auto-)focus until you are sure you understand what it is doing. I don't think it is necessary with this rather small clp file.
The main issue could have been this: Make sure to use
(questions ... (valid $?valid))
alway with the $ in front of $?valid or similar - it's a multislot.
And I think you need
(defrule questions_basique_4
=>
(assert (ask symptome_majeur_2))) ;; not _1

Merging Columns - Run-time Error 1004: Power Query Macro

Hoping you can help solve a problem that has melted my brains for the past number of days.
I'm new to marcos and Excel Power Query in particular, I am trying to merge a number of non adjoining columns in a workbook and was able to do this successfully in Power Query. My aim is to automate this as much as possible so I decided to record a macro.
When running the recorded macro however I am getting Run-time Error 1004.
My Macro code is as follows:
Sub PQ_CSATMerge()
'
' PQ_CSATMerge Macro
'
'
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.CurrentRegion.Select
Application.CutCopyMode = False
ActiveSheet.ListObjects.Add(xlSrcRange, Range("$A$1:$CS$816"), ,
xlYes).Name = _
"Table3"
Range("Table3[#All]").Select
ActiveWorkbook.Queries.Add Name:="Table3", Formula:= _
"let" & Chr(13) & "" & Chr(10) & " Source = Excel.CurrentWorkbook(){[Name=""Table3""]}[Content]," & Chr(13) & "" & Chr(10) & " #""Changed Type"" = Table.TransformColumnTypes(Source,{{""Column1"", type any}, {""Start (UTC)"", type datetime}, {""Visitor ID"", type text}, {""Visitor Name"", type text}, {""MCS"", Int64.Type}, {""Skill"", type text}, {""Agent Name"", type text}, {""Agent Login Name"", type text}, {""Agen" & _
"t Full Name"", type text}, {""Agent Group"", type text}, {""Chat Start Reason"", type text}, {""Chat End Reason"", type text}, {""Chat Requested Time (UTC)"", type datetime}, {""Length (seconds)"", Int64.Type}, {""Interactive"", type logical}, {""Engagement ID"", Int64.Type}, {""Goal"", type text}, {""Campaign"", type text}, {""Target Audience"", type text}, {""Enga" & _
"gement Name"", type text}, {""Visitor Behavior"", type text}, {""Country"", type text}, {""State"", type text}, {""City"", type text}, {""ISP"", type text}, {""Organization"", type text}, {""IP Address"", type text}, {""Device"", type text}, {""Browser"", type text}, {""Operating System"", type text}, {""Chat Start Page"", type text}, {""Chat Start URL"", type text}" & _
", {""Transcript"", type text}, {""Personal Info Exists"", type logical}, {""Customer Info Exists"", type logical}, {""Marketing Source Exists"", type logical}, {""Lead Exists"", type logical}, {""Lead - Topic"", type text}, {""Visitor Error Exists"", type logical}, {""Service Activity Exists"", type logical}, {""Viewed Product Exists"", type logical}, {""Viewed Prod" & _
"uct - Products"", type any}, {""Transaction Exists"", type logical}, {""Transaction - Total"", type any}, {""Transaction - Order ID"", type any}, {""Cart Update Exists"", type logical}, {""Cart Update - Total"", Int64.Type}, {""Cart Update - Number of Items"", Int64.Type}, {""Cart Update - Products"", type any}, {""Pre-Chat Survey Exists"", type logical}, {""Post-Ch" & _
"at Survey Exists"", type logical}, {""Agent Survey Exists"", type logical}, {""Chat Data Enriched"", type logical}, {""Line of Business"", type text}, {""Search Content Exists"", type logical}, {""CoBrowse - Num Sessions"", Int64.Type}, {""CoBrowse - Num Interactive Sessions"", Int64.Type}, {""Alerted MCS"", Int64.Type}, {""Chat MCS"", Int64.Type}, {""Exit Survey - " & _
"France - Exit Survey - Voulez-vous recevoir une transcription de ce chat?"", type text}, {""Exit Survey - France - Exit Survey - Adresse e-mail"", type text}, {""Exit Survey - France - Exit Survey - L'agent du chat était-il capable de résoudre votre requête ou de vous diriger vers une personne capable de vous aider ?"", type text}, {""Exit Survey - France - Exit Sur" & _
"vey - Quelle est la probabilité de recommander SAS à un ami ou à un collègue?"", type any}, {""French_CSAT"", type text}, {""Exit Survey - France - Exit Survey - Dans l'ensemble, était-il facile d'obtenir l'information ou l'aide dont vous avez eu besoin aujourd'hui?"", type text}, {""Exit Survey - France - Exit Survey - Veuillez nous faire part de vos commentaires o" & _
"u suggestions sur la meilleure façon de vous servir"", type text}, {""Exit Survey - Italy - Exit Survey - Desidera ricevere per email una copia della chat?"", type text}, {""Exit Survey - Italy - Exit Survey - Se sì, la preghiamo di fornire la sua email:"", type text}, {""Exit Survey - Italy - Exit Survey - Raccomanderebbe SAS ad un amico o un collega?"", type any}," & _
" {""Italian_CSAT"", type text}, {""Exit Survey - Italy - Exit Survey - Nel complesso, quanto è stato facile ottenere le informazioni o l’aiuto di cui aveva bisogno oggi?"", type text}, {""Exit Survey - Italy - Exit Survey - La preghiamo di fornire dei suggerimenti al fine di poter migliorare il nostro servizio:"", type text}, {""Exit Survey - Netherlands - Exit Surv" & _
"ey - Wilt u dat wij u een kopie van deze chat emailen?"", type text}, {""Exit Survey - Netherlands - Exit Survey - Email adres"", type text}, {""Exit Survey - Netherlands - Exit Survey - Was de chatagent in staat om uw vraag op te lossen of u te leiden naar iemand die kan helpen?"", type text}, {""Exit Survey - Netherlands - Exit Survey - Hoe waarschijnlijk zou u SA" & _
"S aan een vriend of collega aanbevelen?"", Int64.Type}, {""Dutch_CSAT"", type text}, {""Exit Survey - Netherlands - Exit Survey - Hoe makkelijk was het om de informatie of hulp die u nodig had vandaag te verkrijgen?"", type text}, {""Exit Survey - Netherlands - Exit Survey - Geef ons alstublieft feedback of suggesties over hoe we u beter kunnen bedienen. "", type te" & _
"xt}, {""Exit Survey - SAS Exit Survey - English - Would you like us to email you a transcript of this chat?"", type text}, {""Exit Survey - SAS Exit Survey - English - Email Address"", type text}, {""Exit Survey - SAS Exit Survey - English - Was the chat representative able to resolve your inquiry or direct you to someone#(cr)#(lf)who could help?"", type text}, {""E" & _
"nglish_CSAT"", type text}, {""Exit Survey - SAS Exit Survey - English - How likely would you be to recommend SAS to a friend or colleague?"", type any}, {""Exit Survey - SAS Exit Survey - English - Overall, how easy was it to get the information or help you needed today?"", type any}, {""Exit Survey - SAS Exit Survey - English - Please provide us with any feedback o" & _
"r suggestions for how we can serve you better."", type text}, {""Exit Survey - Spain - Exit Survey - ¿Le gustaría que le enviemos por correo email una copia de este chat?"", type text}, {""Exit Survey - Spain - Exit Survey - Email"", type text}, {""Exit Survey - Spain - Exit Survey - El agente del chat fue capaz de resolver tu consulta o dirigirte a alguien que podr" & _
"ía ayudarte?"", type text}, {""Exit Survey - Spain - Exit Survey - ¿Qué probabilidad hay que le recomiende SAS a un amigo o compañero?"", type text}, {""Spanish_CSAT"", type text}, {""Exit Survey - Spain - Exit Survey - En general, con que facilidad ha recibido la información o ayuda que necesitaba hoy?"", type text}, {""Exit Survey - Spain - Exit Survey - Por favor" & _
", facilítanos cualquier comentario o sugerencia sobre cómo podemos mejorar el servicio."", type any}, {""Chat Operator Survey - SAS Operator Survey - English - What was the nature of the chat?"", type text}, {""Chat Operator Survey - SAS Operator Survey - English - Referred or Resolved?"", type text}, {""Chat Operator Survey - SAS Operator Survey - English - Area""," & _
" type text}, {""Chat Operator Survey - SAS Operator Survey - English - If further explanation needed, please provide here:"", type text}})," & Chr(13) & "" & Chr(10) & " #""Merged Columns"" = Table.CombineColumns(Table.TransformColumnTypes(#""Changed Type"", {{""Column1"", type text}}, ""en-GB""),{""Column1"", ""French_CSAT"", ""Italian_CSAT"", ""Dutch_CSAT"", ""English_CSAT"", ""Spanish_CS" & _
"AT""},Combiner.CombineTextByDelimiter("""", QuoteStyle.None),""Merged CSAT"")" & Chr(13) & "" & Chr(10) & "in" & Chr(13) & "" & Chr(10) & " #""Merged Columns"""
ActiveWorkbook.Worksheets.Add
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:= _
"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=Table3;Extended Properties=""""" _
, Destination:=Range("$A$1")).QueryTable
.CommandType = xlCmdSql
.CommandText = Array("SELECT * FROM [Table3]")
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.PreserveColumnInfo = True
.ListObject.DisplayName = "Table3_2"
.Refresh BackgroundQuery:=False
End With
End Sub

itgensdf054 on synchronize in Invantive Control

When synchronizing a model in Excel with one block, I receive an itgensdf054 error which indicates that it could not clear the target range where the data of the query below is synchronized into.
The full error message is:
Could not clear contents of the range ''Aangifte Bebat'!$A$6:$Q$129' of block 'ECO'.
Deze wijziging kan niet worden doorgevoerd voor de geselecteerde cellen omdat ze van invloed zijn op een draaitabel. Gebruik de lijst met velden om het rapport te wijzigen. Verplaats de draaitabel en probeer het opnieuw als u cellen wilt invoegen of verwijderen
Call stack:
Type: System.Runtime.InteropServices.COMException
bij System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
bij Microsoft.Office.Interop.Excel.Range.ClearContents()
bij Invantive.Producer.Control.SyncToDatabaseForm.SyncDownload(DoWorkEventArgs e) in File176:regel 1508
bij Invantive.Producer.Control.SyncToDatabaseForm.SyncDownload(DoWorkEventArgs e)
bij Invantive.Producer.Control.SyncToDatabaseForm.syncBackGroundWorker_DoWork(Object sender, DoWorkEventArgs e)
bij System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
The block 'ECO' synchronizes data from the following query on Exact Online:
select /*+ join_set(sik, invoiceid, 100) join_set(sil, invoiceid, 100) join_set(itm, id, 100) join_set(itr, id, 100) */sil.itemcode
, sil.description
, bom.batchquantity
, sil.quantity
, sil.netprice
, sil.amountdc
, sil.vatamountdc
, sil.vatcode
, sil.vatcodedescription
, sil.vatpercentage
, sik.invoicenumber
, sil.linenumber
, itr.itemgroupcode
, itm.class_04 --aanpassen naar inrichting klant = assortiment bebat_nomenclatuur
, itm.class_10 -- is assortiment 10 instellingen stuklijst explosie
, case
when sik.invoicenumber is not null
then '=if($C{D,.,.,.-5,.}=$C{D,.,.,.-5,.-1}, if($C{D,.,.,^+2,.}= "", $C{D,.,.,^,.-1}, $C{D,.,.,^,.}), $C{D,.,.,^,.})'
end
ass_itemcode
, case
when sik.invoicenumber is not null
/*=""&ALS(K6=K5;ALS(C6<>"";N6;N5);N6)*/
then '="" & if($C{D,.,.,.-6,.}=$C{D,.,.,.-6,.-1}, if($C{D,.,.,^+2,.} <> "", $C{D,.,.,.-3,.}, $C{D,.,.,.-3,.-1}), $C{D,.,.,.-3,.})'
end
nomenclatuur
from ExactOnlineREST..SalesInvoiceLines sil
join ExactOnlineREST..SalesInvoices sik
on sil.invoiceid = sik.invoiceid
join ExactOnlineREST..Items itm
on sil.item = itm.id
join ExactOnlineREST..ItemsRead itr
on sil.item = itr.id
left
outer
join ExactOnlineXML..BillOfMaterials bom
on sil.itemcode = bom.item_code_attr
order
by sik.invoicenumber
, sil.linenumber
The query or the model has not changed when it worked before.
There is a pivot table in the Excel sheet which summarizes the list of sales details.
What is causing this error?
From your comments I understand that the pivot table is in 'Aangifte Bebat' worksheet, but the downloaded is in 'Details' worksheet.
I think you have made a slight alteration. Probably you have inserted or moved a new worksheet BEFORE the Details worksheet. Since Invantive Control downloads based upon the number of the worksheet, the data has now been moved.
Make sure that the original order of worksheets is restored.

Getting attachment in vb.net from gmail

Here's my code to retrieve attachment from Gmail message
Dim attachPart As MessagePartBody = myGMailService.Users.Messages.Attachments.Get(ProfileUsager.GoogleAccountUserName, ID, attachmentID).Execute()
Dim fileByteArray() As Byte = Convert.FromBase64String(attachPart.Data())
My problem is Convert.FromBase64String, this return:
L'entrée n'est pas une chaîne Base 64 valide, car elle contient un caractère non-Base 64, plus de deux caractères de remplissage ou un caractère non conforme parmi les caractères de remplissage.
How I can resolve this? This code is a code block I found on Google API doc.

Resources