Form to compare two fields ... cast needed?
Hi all gurus,
I'm rebuilding a report that performs a lot of checks by comparing fields of two different structures.
Basically, the check has a structure that is repeated over and over in many check: it looks like this:
IF srm_items-{field1} NE r3_services-{field2}.
t_temp-prezzi_errati = icon_red_light.
t_temp-error_code = '{errorcode}'.
IF counter_s = 0.
PERFORM add_son_in_t_temp USING srm_items e_backend w_obj-posting_date w_obj-changed_at.
ELSE.
PERFORM add_additional_error_temp USING srm_items 0.
ENDIF.
counter_s = counter_s + 1.
fl_errore_s = 'X'.
I was thinking to create a form, say 'check_son', that takes as USING parameter , and . My doubt is about types ad casts; in a check, could be a text string, in another a number, in another again a guid, and so on. Always simple field (no structures or complex field by now), but for what that concerns my FORM:
FORM check_son USING compare1
compare2
errorcode.
how should I declare the form in order to have the check working? I mean, I'd like that compare1 and compare2 get the same TYPE of the parameter I pass.. Is there a way? Or implicitly the params are converted into text (this should not work for me)?
Thanks in advance
>
Matteo Montalto wrote:
> I don't know macros
Hi, Matteo
Test the following Sample Code it will help you to understand the working of Macros.
DEFINE check_son.
if &1 NE &2. " If Field1 Not Equal Field2
&3 = 'NE'. " In This Variable it will Return Error Code NE for Not Equal and EQ for Equal
else.
&3 = 'EQ'.
endif.
END-OF-DEFINITION.
DEFINE write_message.
if &1 = 'EQ'.
write: 'Two Numbers are Equal', /.
else.
write: 'Two Numbers are Not Equal', /.
endif.
END-OF-DEFINITION.
DATA: f1 TYPE i,
f2 TYPE i,
error_code(2).
f1 = 10. f2 = 15.
check_son f1 f2 error_code.
write_message error_code.
f1 = 10. f2 = 10.
check_son f1 f2 error_code.
write_message error_code.
Please Reply if any Confusion,
Best Regards,
Faisal
Similar Messages
-
I would like to compare two field and then is it's true then the output will be the 2nd one
Hello All,
I am doing a mappong where i need to compare two field and then if there are equal the 2nd one should be the output and 2nd value will be using multiple segment.
It's for shipment.
Regards
RituparnaNot sure if i understand correctly. But you are trying to compare one field with multiple occurrences of another field.
You can make use of the node function "Use One as Many" and repeat the first value as many times as the second value.
Please refer to below wiki.
Explain node functions - Process Integration - SCN Wiki -
Is there is any way to create a validator to compare two fields (like a pa
Hi,
Is there is any way to create a validator to compare two fields (like a password and a retype password ) ?
please give me any suggestion or any example related this problem!!
thanks,
Praveen SoniUgh, do you have taken over the LimitValidator and the JSF example (including the f:validateDoubleRange which is unnecessary in this case) literally without actually reading/interpreting/understanding it? No, then it is indeed not going to work. Basically you just need to define a validator in the one password field and pass the client ID of the another field as attribute along the one password field. In the validator you can retrieve the value of the another field by its client ID and finally just invoke String#equals() on the values of the both fields.
-
Compare two fields of one table in selection.
Dear Experts,
I want to compare two fields of a table and make selection according to this.
Ex: simply i want to select the rows from table mard where mard-labst>mard-insme. Could you write me the code to make this selection.Yes, Thomas,
Its working:
Sample code:
data: begin of itab occurs 0,
matnr type matnr,
ernam type ernam,
end of itab.
select matnr ernam
into table itab
from mara where brgew > mara~ntgew.
loop at itab.
write: itab-matnr.
endloop.
Or,
Try with inner join once.
Its working: Sample code.
data: begin of itab occurs 0,
matnr type matnr,
ernam type ernam,
end of itab.
select p~matnr q~ernam
into table itab
from mara as p
inner join mara as q
on p~brgew > q~ntgew.
loop at itab.
write: itab-matnr.
endloop.
Thanks,
Naveen.I -
How to compare two fields from the same table in the select statement
Hi, friends
I try to compare tow fields from the same table, but no result,
For example, this
data: cptotchek tyep i.
select count(*) into cptotchek
from aufk where erdat = aufk-idat2 .
The result is cptotchek = 0, but there are the records in aufk , where, aufk-erdat = aufk-idat2.
Please, help me, i don't use the loop statement for optimize my program.
RegardsHi ,
it will not return any value when you are using column of same table
such as Date Field , Because while Using Aggregate Function it will not check with self column
. For that you have to take data in one internal table and then you can work on it .
And if you are worried about Performance it will not affect , untill you are selecting only required data .
you can try this way .
data: cptotchek type i.
types : begin of w_aufk.
include structure aufk .
types : end of w_aufk .
data : it_aufk type standard table of w_aufk with header line .
select * into corresponding fields of table it_aufk
from aufk .
loop at it_aufk .
if it_aufk-erdat = it_aufk-idat2 .
write : / it_aufk-erdat , it_aufk-idat2 .
else .
delete it_aufk .
endif .
endloop.
Regards
Deepak. -
How to compare two fields in two seperate databases
Hi
Can we compare two columns in two separate databases with a one script.
Cheers
ShabarHi,
if you mean Oracle to sqlserver then you would have to put hand in pocket and buy ODBC connectivity for this...
If it is just a one off maybe export your data and import into Oracle table and do your one off comparision.
regards,
Robert. -
Hi Experts,
I want to compare two characteristics in bex. Is it possible to do in BEx ? If yes, how can i do it.
If char A is equal to char B, display value of this key figure other wise display value of this key figure.Hi
try this out:
1) create 2 variables with Processing Type : Replacement Path and select the charc required.
2) create 2 formula key figs. taking values from 2 diff. variables.
3) include the variables into the formula key figs. created above respct. and the compare them.
Hope it will resolve ur issue.
Thanks,
Jitender
Edited by: Jitenderkumar Danduvia on Mar 13, 2010 7:49 AM -
How to compare two fields in condition editor in receiver determination
Hello,
Is it possible to compare to fields frrom the source in the condition editor of Receiver Determination?
Because on the right hand operand we can specify only constants right and not the source field.
For eg: If field1 != field2 then Reciever = Receiver1
Thanks,
LoveenaIn standard receiver determination while defining the condition, you can only specify an element from the message payload using expression editor to create an expression for the left operand and you must specify a fixed value in the right operand, against which the value of the element will be compared at runtime. You can use only these (=,, ,EX) operators. So the functionalities are limited.
so you have to use Enhanced Receiver Determination, In this Instead of creating the receivers in the receiver determination manually, you assign an Interface mapping to the receiver determination and this returns a list of receivers at runtime.
refer this wiki for more details
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=133562771 -
Need to compare two fields and populate the other fields.
Hi All,
I have scenario like this.
DATA: text1(150) type C
VALUE 'Step: SHORT DUMP; Scenario: PRE; Date :09.07.2007. Time :13:08:33.'.
DATA: text2(150) TYPE C
VALUE 'Step: &; Scenario: &; &',
DATA: text_A(150) TYPE C,
text_B(150) TYPE C,
text_C(150) TYPE C.
Now I need to compare text1 and text2 and populate text_A, text_B and text_C as follows.
text_A = SHORT DUMP
text_B = PRE
text_C = Date :09.07.2007. Time :13:08:33.
Basically I need to fill text_A, text_A and text_A with the values in text1 which are replaced by '&'.
Can anyone suggest me a code snippet to do it?
Thanks in advance.
Regards
AnkitSorry for slow response - I'm in a different timezone I think... Well it's not a short algorithm, but you could try something like the following (there's probably a sweeter algorithm, but this is what occured to me overnight)... I realise that it's not foolproof as you could have words substituted in for the "&" that also appear in the original message text and that would skew the results...
Jonathan
report zlocal_jc_get_msgvars.
types:
gty_char150(150) type c.
parameters:
p_text_1 type gty_char150 lower case,
p_text_2 type gty_char150 lower case.
initialization.
perform initialization.
start-of-selection.
perform extract_msgv.
*& Form initialization
form initialization.
*" Default screen variables
concatenate
'Step: SHORT DUMP; Scenario: PRE;'
'Date :09.07.2007. Time :13:08:33.'
into p_text_1 separated by space.
p_text_2 = 'Step: &; Scenario: &; &'.
endform. "initialization
*& Form extract_msgv
form extract_msgv.
*" Work out the values that have been substituted
*" into p_text2 to make p_text1
data:
l_text_a type gty_char150,
l_text_b type gty_char150,
l_text_c type gty_char150,
l_text_d type gty_char150,
l_tabix_1 type i,
l_tabix_2 type i,
l_word_1 type gty_char150,
lt_word_1 type gty_char150 occurs 10,
l_word_2 type gty_char150,
lt_word_2 type gty_char150 occurs 10,
l_result type gty_char150,
l_tabix type sy-tabix,
l_tabix_next type sy-tabix,
l_tabix_from type sy-tabix,
l_tabix_to type sy-tabix,
lt_tabix type sy-tabix occurs 4,
lt_result type gty_char150 occurs 10.
*" Break the strings into words
split p_text_1 at space into table lt_word_1.
split p_text_2 at space into table lt_word_2.
format reset.
format color col_total.
write: / p_text_1(80).
write: / p_text_2(80).
format reset.
*" Look at where the words in the shorter string appear in the longer
loop at lt_word_2 into l_word_2.
add 1 to l_tabix_2.
write: / 'P_TEXT_2, Word', l_tabix_2, l_word_2.
if l_word_2+0(1) = '&'. "placemarker
continue.
endif.
*" examine the expanded version
read table lt_word_1 into l_word_1
with key = l_word_2.
if not sy-subrc is initial.
write: /
'ERROR: Word not found in expanded version' color col_negative.
continue.
endif.
l_tabix_1 = sy-tabix. "Where we found word from short msg
append l_tabix_1 to lt_tabix.
endloop.
*" add pointer to end of list of words too
describe table lt_word_1 lines l_tabix_1.
add 1 to l_tabix_1. "because we subtract 1 below...
append l_tabix_1 to lt_tabix.
loop at lt_tabix into l_tabix_from.
l_tabix = sy-tabix.
write: / l_tabix_from.
*" get the range of words we want by getting next tabix row
*" and subtracting 1
l_tabix_next = l_tabix.
add 1 to l_tabix_next.
read table lt_tabix into l_tabix_to index l_tabix_next.
if not sy-subrc is initial. "no more words...
exit.
endif.
add 1 to l_tabix_from.
subtract 1 from l_tabix_to.
loop at lt_word_1 into l_word_1
from l_tabix_from to l_tabix_to.
write: / l_word_1 color col_positive.
* Push into text_A, text_B, text_C, text_D
case l_tabix.
when 1.
concatenate l_text_A l_word_1 into l_text_a
separated by space.
when 2.
concatenate l_text_b l_word_1 into l_text_b
separated by space.
when 3.
concatenate l_text_c l_word_1 into l_text_c
separated by space.
when 4.
concatenate l_text_d l_word_1 into l_text_d
separated by space.
endcase.
endloop.
endloop.
uline.
format reset.
format color col_group.
write: / 'TEXT_A', l_text_a(80).
write: / 'TEXT_B', l_text_b(80).
write: / 'TEXT_C', l_text_c(80).
write: / 'TEXT_D', l_text_d(80).
format reset.
endform. "extract_msgv -
How to compare two fields from different list sharepoint designer?
hi All,
I need to add a value to a field using SharePoint designer workflow. The value is from another column.
for example list A has the field has loginID, and another list B has loginID amd another column called Desig.
i need to compare both and get the Desig field and store it to a column. how do i do that in sharePoint Designer workflow.Hi,
you can create a workflow variable ex.Test. and add an action set Workflow variable. Then you have to set this variable value using lookUps. something like(in look up window)
Data source: Choose List B
Field from source: Choose Desig
Then under find the list item
Field: Choose login Id
Value :(Again open lookup window by clicking "fx") and in this window choose
data Source: List A
field from source :LoginId
and click ok.
attached is the image for your reference. (I am using other lists,you can change appropriately ) -
How to compare two fields from two different groups
My RTF template is like this.
GROUP A
Field 1 Field 2 Field 3 (Display in table)
GROUP B
**Condition
Display Fields from B
end GROUP B
end GROUP A
But I need the following condition to be added at the place (** Condition)
IF A.Field1 = B.Field1
Display fields from B
END IF
end Group B
end Group A
Please help, if anyone has come across such a situation.
Thanks,
AnandYou can use variables to store the A.field1 value and then compare it against B.Field1.
Take a look at this post for an example: https://blogs.oracle.com/xmlpublisher/entry/formatting_concatenated_dataso
Thanks,
Bipuser -
Tabular Form Validation: Comparing Two Columns vs Check Constraint
What is the best approach for validating that one column needs to be greater than another column in a tabular form when attempting to save. (E.g. An effective date and expirey date column. The expirey date column >= effective date column)
At the moment I have a check constraint on the two columns at the database level which is fine but it returns and passes up a pretty cryptic (from a business user perspective) unfriendly message to the user as follows:
Error in mru internal routine: ORA-20001: Error in MRU: row= 1, ORA-02290: check constraint (IDMTC.ADDRESS_TYPE_CON) violated, update "IDMTC"."ADDRESS_TYPE" set "ID" = :b1, "CODE" = :b2, "NAME" = :b3, "LOV_SORT_ORDER" = :b4, "DESCRIPTION" = :b5, "EFFECTIVE_DATE" = :b6, "EXPIRY_DATE" = :b7 where "ID" = :p_pk_col
Unable to process update.
Is there a way to inject, detect and/or replace this with a friendlier business user message? I have confirmed that the "Unable to process update." text at the bottom below the MRU Internal routine error raised from my check constraint is the process error message for my Apply MRU process.
I was hesitating going down a larger page level validation where I loop through the tabular form array and/or inject some client side Javascript.
Any advice? Have I simply overlooked some tabular form options for validating using cross column values?
Thanks,
JeffJeff..Thanks for the response.
However because I am working in a tabular form at design time I don't know which controls I can reference in a dynamic action, or custom Javascript routine other than selecting all elements in a column using JQuery, etc.
I have decided to go with for the time being an approach I found here: doing validation on tabular form
My code ended up looking something like and was entered into a page level validation as a PL/SQL function body returning error text.:
DECLARE
l_error VARCHAR2 (4000);
BEGIN
FOR i IN 1 .. apex_application.g_f02.COUNT
LOOP
--If Expiry date is older then effective date
IF nvl(apex_application.g_f08 (i), to_date('31-DEC-9999', 'dd-mon-yyyy')) < apex_application.g_f07 (i) THEN
l_error :=
l_error
|| '</br>'
|| 'Row '
|| i
|| ': Expiry date must be greater than effective date '
|| ' for maintenance item name: '
|| apex_application.g_f03 (i);
END IF;
END LOOP;
RETURN LTRIM (l_error, '</br>');
END;
I had been hoping with Apex 4+ that there was additional native functionality to do this type of validation or somehow be able to reference a column or control name instead of a generic array column so that my code was better self documenting.
It works for now...but would love to revisit with maybe a cleaner client side solution that does the validation and highlights the invalid element since I still maintain data integrity at the db with the check constraint.
Thanks,
Jeff -
Hi
I have a table with 2 fields
ROW....FIELD1.......FIELD2
001.......XX_0020......XX_20
002.......XX_0002......XX_2
003.......XX_0200......XX_200
004.......XX_0201......XX_200
005.......XX_0037......XX_39
In select statement I would like to get only rows: 001, 002 and 003
because in these rows FIELD1 = FIELD2 if all zeros between "XX_" and first sign not equal "0" in FIELD1 are not taken into consideration.
Regards
PWnukfor simple demo check this...
data: begin of itab occurs 0,
field1 type i,
field2 type i,
end of itab .
itab-field1 = '10'.
itab-field2 = '0010'.
append itab .
itab-field1 = '20'.
itab-field2 = '0020'.
append itab .
itab-field1 = '30'.
itab-field2 = '0030'.
append itab .
loop at itab .
if itab-field1 = itab-field2 .
write:/ itab-field1 , itab-field2 .
endif.
endloop. -
Compare two fields and populate a third
I am trying to do the following:
Filed A number of days leave left
Field B Total number of days requested (some of other Fields)
Field C = A - B
Field D = Listed number of days unpaid to be taken
If C < 0 then D = C
I am using the following code
// Get the field values, as numbers
var v1 = this.getField("leaveleft").value;
var v2 = this.getField("totaldaysrequested").value;
var v3 = this.getField("daysleft").value;
var v4 = this.getField("unpaiddays").value;
if (v2 < "0") v4 = v3;
unpaiddays.value = v4.value;
This is not populating the field, what am i doing wrong?Assuming this is the calculation script for "unpaiddays", use this code instead of what you have now:
var v1 = +this.getField("daysleft").value;
event.value = (v1<0) ? v1 : ""; -
How to compare the two field in jasper report design
hi to all,
I am new to jasper report design
I want to compare two fields (or) variable using if..else condition.
pls help me outCheck out these postings:
http://forum.java.sun.com/thread.jspa?threadID=5286462
http://forum.java.sun.com/thread.jspa?threadID=5286468
Maybe you are looking for
-
How do I stop my iPod from turning itself on and off??
My button on my IPod has been broken for a while now but that's fine. But just recently my iPod started turning itself on and off as if I'm pressing the lock button. This problem is VERY annoying. If anyone knows how to fix this PLEASE help.
-
How to start FF4 in fullscreen mode without any extension?
I already called "BrowserFullScreen();" in browser.js:delayedStartup(), but then, the Firefoxwindow has an y-offset of -5 instead of 0. Already fixed this by adding 5 to gNavToolbox.style.marginTop. But afterwards, if I enter normale mode and fullscr
-
Ichat 3.1.8 freeze when starting videoconversation
I have used ichat videoconversation for over 8 months now and all of a sudden it stopped working. I haven't done a thing. I can see and hear the other person and he can hear me but my pic freeze just when the chat starts. I have a pc with aim 5.5 and
-
CS6 InDesign- can't change colors, text, etc.?
My CS6 InDesign is having some major issues. I'm currently unable to change colors, text, photos, at times I can't even select the selection tool itself. I recently got so frustrated I wiped it from my PC and re-installed it... and STILL have the sam
-
JBOSS WONT DEPLOY BC4J.EAR - FAILS
Following instructions found elsewhere in OTN, I have set up JBOSS to use BC4J by copying relevant files to the JBOSSHOME/lib/ext folder and by deploying BC4J.EAR into the JBOSS deploy folder. Deployment fails mentioning that it is missing a class ..