I try to construct a SP in FB 2.5 that looks like that:
where
(
(kunde between :kdvon and :kdbis)
and
(AdrGrp between :AdrGrpvon and :AdrGrpbis)
and
(auftragstyp between :AuftrTypVon and :AuftrTypBis)
and
(Status between :statusvon and :statusbis)
and
IF LFDNR <> 0 THEN (LFDNUMMER = :LFDNR)
IF BESTELLTAG <> 0 then (bestelldatum = :BESTELLTAG)
)
It worked well until the If Statements were inserted.
After that I get the message
SQL error code = -104.
Token unknown - line 156, column 14.
LFDNR.
The IF conditions are defined as Input Parameters. Using the colon : to mark them as parameters did not work.
Question
Is it possible to use "If" inside "Where" in this way?
How do I have to use the condidional params?
TiA
Rolf
Try this instead:
...
AND (LFNDR = 0 OR LFDNUMMER = :LFDNR)
AND (BESTELLTAG = 0 OR bestelldatum = :BESTELLTAG)
(I don't know if LFNDR and BESTELLTAG are parameters/variables or columns in the = 0 clause - if they are parameters (the same as the right hand part), you should probably mark them with a ':')
Related
I've being trying this language and i keep getting random syntax errors and i cant figure out why, this is a simple recoil script. It keeps telling me i have a syntax error on line 39, everything is green so i can still try it out while i try to fix. I can post the rest of the code if someone needs.
Code:
function recoil_values()
if gun_mode = "gun1" then
if round = "attack" then
--Ash R4C--
x_recoil = -1
y_recoil = 4
sleep_value = 10
else
--Twitch F2--
x_recoil = -10
y_recoil = 0
sleep_value = 10
end
else
if round = "attack" then
--Jager 41C--
x_recoil = 10
y_recoil = 0
sleep_value = 10
else
--Bandit MP7--
x_recoil = 0
y_recoil = 10
sleep_value = 10
end
end
end
Your if statements contain =, which is used for assignment. Lua does not allow assignments between if and then.
If you want to compare two values for equality, use ==.
my idea is the convert the 2 strings into byte, subtract and then check if they're 0 using a for loop like this
function match(str1, str2, callback)
local res = string.byte(str1) - string.byte(str2)
for i = 1, res(0) do
spawn(callback)
end
end
but that just doesn't work can anyone write me a code would appreciate...
rawequal(str1, str2) -- Compares two values without calling any metamethods
Via an enterpreise service consumer I connect to a webservice, which returns me some data, and also url's.
However, I tried all methods of the mentioned class above and NO METHOD seems to convert the unicode-characters inside my url into the proper readable characters.... ( in this case '=' and ';' ) ...
The only method, which runs properly is "is_valid_url", which returns false, when I pass url's like this:
http://not_publish-workflow-dev.hq.not_publish.com/lc/content/forms/af/not_publish/request-datson-internal/v01/request-datson-internal.html?taskId\u003d105862\u0026wcmmode\u003ddisabled
What am I missing?
It seems that this format is for json values. Usually = and & don't need to be written with the \u prefix. To decode all \u characters, you may use this code:
DATA(json_value) = `http://not_publish-workflow-dev.hq.not_publish.com/lc`
&& `/content/forms/af/not_publish/request-datson-internal/v01`
&& `/request-datson-internal.html?taskId\u003d105862\u0026wcmmode\u003ddisabled`.
FIND ALL OCCURRENCES OF REGEX '\\u....' IN json_value RESULTS DATA(matches).
SORT matches BY offset DESCENDING.
LOOP AT matches ASSIGNING FIELD-SYMBOL(<match>).
DATA hex2 TYPE x LENGTH 2.
hex2 = to_upper( substring( val = json_value+<match>-offset(<match>-length) off = 2 ) ).
DATA(uchar) = cl_abap_conv_in_ce=>uccp( hex2 ).
REPLACE SECTION OFFSET <match>-offset LENGTH <match>-length OF json_value WITH uchar.
ENDLOOP.
ASSERT json_value = `http://not_publish-workflow-dev.hq.not_publish.com/lc`
&& `/content/forms/af/not_publish/request-datson-internal/v01`
&& `/request-datson-internal.html?taskId=105862&wcmmode=disabled`.
I hate to answer my own questions, but anyway, I found an own solution, via manually replacing those unicodes. It is similar to Sandra's idea, but able to convert ANY unicode.
I share it here, just in case, any person might also need it.
DATA: lt_res_tab TYPE match_result_tab.
DATA(valid_url) = url.
FIND ALL OCCURRENCES OF REGEX '\\u.{4}' IN valid_url RESULTS lt_res_tab.
WHILE lines( lt_res_tab ) > 0.
DATA(match) = substring( val = valid_url off = lt_res_tab[ 1 ]-offset len = lt_res_tab[ 1 ]-length ).
DATA(hex_unicode) = to_upper( match+2 ).
DATA(char) = cl_abap_conv_in_ce=>uccp( uccp = hex_unicode ).
valid_url = replace( val = valid_url off = lt_res_tab[ 1 ]-offset len = lt_res_tab[ 1 ]-length with = char ).
FIND ALL OCCURRENCES OF REGEX '\\u.{4}' IN valid_url RESULTS lt_res_tab.
ENDWHILE.
WRITE / url.
WRITE / valid_url.
This question already has answers here:
Use table key inside same (anonymous) table
(2 answers)
Closed 5 years ago.
So I'm trying something which i think should be very easy, but I just can't get it to work...
Basically what I'm trying to do is:
myTable = {
a = 1,
b = a + 1
}
This is not working, I get the error that "a" is nil. Reasonable.
What i have already tried is
myTable = {
a = 1,
b = myTable.a + 1
}
and
myTable = {
a = 1,
b = self.a + 1
}
But it gives me the error me that "myTable"/"self" is nil.
I got the feeling that the solution is rather simple but i couldn't find it out by myself and google wasn't that helpful as well.
There's no way of doing this in one statement (at least not without calling any functions or using metatables). That's because in a statement like foo = bar, the foo variable isn't assigned until the bar expression has been evaluated.
In your second example, the myTable variable isn't assigned until the closing curly brace, so the myTable in myTable.a + 1 is treated as an unnassigned global variable, and gets a value of nil. The self in your third example is the same, only you don't try to assign anything to it later. (In Lua, self is only special inside functions written with the colon syntax.)
To do what you want to do, you have to do something like this:
myTable = {
a = 1
}
myTable.b = myTable.a + 1
Or this:
local a = 1
myTable = {
a = a,
b = a + 1
}
I have a variable in groovy like below:
project.Map
{
time.'1 1 * ?' = ['T1']
time.'2 1 * ?' = ['T2']
templates.'T1' = ['Z','X','Y']
templates.'T2' = ['Q']
}
Sorry but I am new to groovy ,when i try to access the individual
variable values in project.map how do i access them
i tried something like below
log.info(grailsApplication.config.project.Map.time[1])
log.info(grailsApplication.config.project.Map.get('time.'2 1 * ?'' ))
log.info(grailsApplication.config.project.Map.get('time[0]' ))
log.info(grailsApplication.config.project.Map.time.get('1 1 * ?'))
but they all print null value or object references.how do i access values for
time and templates both within a for loop and without it.
please see http://grails.org/doc/latest/guide/conf.html#config for the ways the config is allowed to nest. your outer syntax is especially mentioned to not be allowed:
However, you can't nest after using the dot notation. In other words, this won't work:
// Won't work!
foo.bar {
hello = "world"
good = "bye"
}
You have to write it as
project { Map { ... } }
The inner dotted parts (with the assignment) are ok (according to the doc)