SAP IRPA Desktop Studio ctx.outlook.search filter E-mails by Date will not Work - sap

I am trying to identify e-mails dynamically based on the current date.
I am having troubles putting the variable inside the statement:
Below on line 2 I try to concatenate PRDatafromProvider text with date which I set earlier. Perhaps the syntax is wrong. I set the date variable correctly and it logs fine.
ctx.outlook.mail.search({
filter : "\"" + "urn:schemas:httpmail:subject" + "\"" + "= 'PRDatafromProvider'" + date + " AND
" + "\"" + "urn:schemas:httpmail:read" + "\"" + "= 0",
//"urn:schemas:httpmail:date" + "\"" + "= '20200610'",
maxRow : 10,
dontThrowExceptionIfNoMailFound: true
});
Another question is the 4th line above, I comment it out because the code works fine without it but when I put that line back it will not executed and break the search method. This is why I am trying to put it in subject so that I can somehow go around it...
I am usually active online: if I missed any details, I can provide them quickly.

Related

concatenating fields with no line break in SSRS

I want to concatenate couple fields into one line using expression in SSRS
=Fields!Address1.Value & Fields!Address2.Value +" " + Fields!City.Value + " " + Fields!State.Value
But all the fields have a line break. It is driving me nuts. I need to get rid of the line break.
I also tried this in my query:
Concat(loc.Address1, loc.Address2,loc.City, loc.State) AS FullAddress
Still won't work.
Use this in your expression:
This is to replace char(10) (also known as vblf line break) with empty string "". It should get you the result.
Replace(Fields!Address1.Value & Fields!Address2.Value +" " + Fields!City.Value + " " + Fields!State.Value),char(10),"")
Perhaps you have char(13) and/or char(10) in your data.
Replace(Replace(Concat(loc.Address1,' ',loc.Address2,' ',loc.City,', ',loc.State),char(10),''),char(13),'') AS FullAddress

Access: Runtime error 3075 (missing operator) in SQL update query

First time using Access and wanted to make an update query that uses a variable for its table name. Now, I've gotten myself into a web of nothing good. When I get to the part the SQL code is needed for, I get Runtime error 3075 - Missing operator in '(((" + enteredid + ".todayDate)=Format(Now()','""Short Date"")))' I've never coded in SQL, so I have no clue what operators are needed.
My code:
strSQL = "UPDATE " + enteredid + " SET " + enteredid + ".signIn = Format(Now(),""Short Time"") WHERE (((" + enteredid + ".todayDate)=Format(Now()','""Short Date"")));"
My suggestions:
You can avoid the whole Format() issue in the WHERE clause by using the Date() function instead of trying to extract just the date part of Now().
Since you are doing an UPDATE on a single table you can just use the field (column) names without the TableName. prefix.
To make your code more robust, enclose the table name in square brackets so it won't crash if the table name contains spaces or other "funny" characters.
So, the revised code would look more like this:
strSQL = _
"UPDATE [" + enteredid + "] SET " + _
"signIn = Format(Now(),""Short Time"") " + _
"WHERE todayDate = Date()"

SSRS 2008 Expression

I am trying to write IIF statement in SSRS 2008 experssions but can run only one part at a time... the other part gives error... here is what am writing..
=IIF(Parameters!Month.Value = 1, " "& CStr(MonthName(Parameters!Month.Value +11)) &" " , "ABC")
When ever i run this and value of Month parameter = 1 then it runs fine but when value <> 1 then it gives #Error... The false part is not executing... I think some thing wrong with double quotes...
Even if i change positions of true and false sets...result is same... If i simply write like..
=IIF(Parameters!Month.Value = 1, "CDE" , "ABC")
then it all runs fine...
Please help...
Looks like an assumptive mismatch of metadata. Even though you are calling out CStr() it could be something on that front. Trying wrapping the false statement in CStr() as well as dropping the " " & and & " " and see what happens. That's where I'd start.
Resolved it.....
=IIF(Parameters!Month.Value = 1,
MonthName((((Parameters!Month.Value-1)+11) Mod 12 )+ 1) + "-" + CStr(Parameters!Year.Value - 1),
MonthName((((Parameters!Month.Value-1)+11) Mod 12 ) + 1) + " - " + Parameters!Year.Value)
There is no issue with the Quotes.
Months are only between 1 to 12. Based on your equation Parameters!Month.Value can only be from -10 to 1.
If you supply any value greater than 1 or less than -10 or any decimal values you expression will error out. You need to check all the values you are passing in Parameters!Month.Value or change your expression.

DELETE FROM table WHERE var = value does not remove entries

So I fetched some data from a mdb file in c# via
"SELECT * FROM " + listBox1.GetItemText(listBox1.SelectedItem) + " WHERE Note = '" + listBox2.GetItemText(listBox2.SelectedItem).Replace("'","\'") + "'";
which selects the right data, here it is
SELECT * FROM Main WHERE Note ='Hello'
The mdb data structure looks like this being plotted as a CSV-file:
"Record ID";Status;Placement;Private;Category;Note;Blob
14341665;4;2147483647;True;3;"""Hello"" - Neues
But when I try to remove entries with
"DELETE FROM " + listBox1.GetItemText(listBox1.SelectedItem) + " WHERE \"Record ID\" LIKE '" + dr[0] + "';";
or
"DELETE FROM " + listBox1.GetItemText(listBox1.SelectedItem) + " WHERE \"Record ID\" = '" + dr[0] + "';";
which looks like for instance
DELETE FROM Main WHERE "Record ID" LIKE '14341665';
The entries just stay there. I can rerun the select command even restart my application, the mdb is not changed.
Is record ID a numeric field? If so, lose the quotes.
DELETE FROM Main WHERE [Record ID] = 14341665;
Note that spaces in field (column) names will always be a problem. Such columns names have to be enclosed in square brackets, as do columns named with reserved words.
The record id is numeric, so don't put apostrophes around it:
"DELETE FROM " + listBox1.GetItemText(listBox1.SelectedItem) + " WHERE \"Record ID\" = " + dr[0]
Note: You should avoid using select * in production code, you should specify the data that you want returned. Also, you should use parameterised queries instead of concatenating values into the query.
if i remember correctly, "like" only works on string data, please check the data type of Record ID.
If Record ID is numeric, you may want to use database's conversion function to convert it into string before filtering using "like".
btw, remember to make sure that dr[0] is properly escaped.

Too few parameters. Expected 1 - but I have one

So I've recently been working on a VBA script to transfer an entire database of student medical records from their old one-table, 68-field, flat system to a new dynamic system with 24 related tables.
There was no issue for the first few tables, but then I ran into this. The line of code throwing the error is:
Set rstFrom = CurrentDb.OpenRecordset("select " & Flat & ".Student," & Flat & ".School," & Flat & ".Social," & Flat & ".FamilyHist from " & Flat & " WHERE 1=1")`
Flat is a String which stores the name of the flat database (this is because I'm working with a dummy database so they will need a convenient and quick way to modify the code I make to work on the real thing)
rstFrom needs to contain only the columns of the 68-field table which are relevant to the table that I'm copying to at the moment (in this case, the FamilyHistory table which really just needs the studentID and FamilyHistory) - note that the original table did not assign unique studentIDs, so I must use the name, school, and social to determine that I am dealing with the same child and look up their studentID
When this line of code runs I get the following error:
Run-time error '3061':
Too few parameters. Expected 1.
Clearly I have 1 parameter, it's:
"select " & Flat & ".Student," & Flat & ".School," & Flat & ".Social," & Flat & ".FamilyHist from " & Flat & " WHERE 1=1"
(which after parsing is):
"select Demos.Student,Demos.School,Demos.Social,Demos.FamilyHist from Demos WHERE 1=1"
The where 1=1 is required when working with Access VBA or else it only returns the first record which matches, not all matching records.
Has anyone else had this same problem as resolved it? I did notice one thing. When I change the parameter to:
"select Demos.Student from Demos WHERE 1=1"
It is able to get past this line no problem, although this causes issues later on when I need to read other data that I did not retrieve. I thought it was interesting, though, that the error seems to be coming from the SQL and not the OpenRecordset function.
Check the field names in the SQL vs what you have in table.
I think, either the field name in above SQL is misspell or you don't have one or more field (of SQL statement) in the table.
The text parameters in the insert query need to have a single quote around them. I ran into the same problem with a query using Visual C++.
Here's the code I ended up using...
void FileInterface::TblWrite(CDatabase* db, rec* r)
{
string sqlQuery = "insert into THREATS(ID,CODE,ID,LAT,LON,SHOW_A,SHOW_B) Values(" +
to_string((_Longlong)r->num) + "," +
to_string((_Longlong)r->code) + "," +
"'" + r->id + "'" + "," +
to_string((long double)r->lat) + "," +
to_string((long double)r->lon) + "," +
"1" + "," +
"1" +
")";
db->ExecuteSQL(sqlQuery.c_str());
}