Java If/Then/Else Statement
Hello,
Just wondering if it is possible to call one java file from within another.
I'm thining wiht an if.then/else statement similar to
If x==true
then run file1.java
else run file2.java
any examples of this, or if it is even possible would be appreciated.
This is something like what I would do.
public class FileRunner {
public static void main(String [] args) {
if ( args[0].equals("file1") {
File1 file1 = new File1();
file1.init() //method you define in File1 that runs everything that would've been in the File1's main method
} else if (args[0].equals("file2") {
File2 file2 = new File2();
file2.init() //method you define in file2 that runs everything that would've been in the File2's main method
} else {
System.err.println("Invalid argument");
System.exit(1);
java.exe FileRunner.class file1
java.exe FileRunner.class file2The other method is to start a new jvm from within java, but that gives you less control than this imo.
Similar Messages
-
If Then Else Statement in SAP R/3 BW
Hi,
Does anyone know how to create an If Then Else statement in BEX?
Thanks,
Mounika.Hi mounika,
do this way
If 'material number' > 0.
rslt = 'enter into table'.
else.
rslt = 15.
endif.
A True condition always evaluates to 1, a False condition evaluates to 0.
for more quieries in bw ..pls go through the link
http://sap.ittoolbox.com/groups/technical-functional/sap-bw
pls reward if helps,
regards. -
How to total 2 colums with an -If then else- statement each
Hello,
I have 2 colums A en B who generate data based on an “If then else” statement.
Colum A
<?xdofx:if (OMZET_YTD_VJ )!='' then ((OMZET_YTD_VJ) * (BM_YTD - BM_YTD_VJ)) div 100 else 0 end if?>
Colum B
<?xdofx:if (BM_YTD)!='' then ((BM_YTD) * (OMZET_YTD - OMZET_YTD_VJ)) div 100 else 0 end if?>
Colum C needs to be the sum of both. Who can help me?
Thanks a lot.Can you send me the RTF template and xml file to [email protected]? I can take a look and try to help.
Thanks,
Bipuser -
Usage of exists in if-then-else statements
please correct the mistakes in this procedure regarding exists in the use of if then else statement .as i am new to oracle i am unable to do it.
errors are statement ignored
exists should be inside the statement;
CREATE or replace FUNCTION CHECK_FG_Id
p_LegacyDocumentId VARCHAR2,
p_LegacyFGroupId VARCHAR2,
p_TransmissionId INTEGER
RETURN INTEGER as
BEGIN
IF EXISTS
(Select FG.ControlNo from functionalgroup FG,document D
WHERE FG.DocumentId=D.Id AND D.TransmissionId=p_TransmissionId
AND FG.ControlNo=p_LegacyFGroupId AND D.ControlNo=p_LegacyDocumentId ) THEN
Return 1;
ELSE
Return 0;
END IF;
end;Lots of different ways...One way is as follows:
CREATE OR REPLACE FUNCTION check_fg_id (
p_legacydocumentid VARCHAR2,
p_legacyfgroupid VARCHAR2,
p_transmissionid INTEGER) RETURN INTEGER AS
vDoesItExist NUMBER;
BEGIN
SELECT COUNT (1)
INTO vdoesitexist
FROM functionalgroup fg,
document d
WHERE fg.documentid = d.ID
AND d.transmissionid = p_transmissionid
AND fg.controlno = p_legacyfgroupid
AND d.controlno = p_legacydocumentid;
IF vDoesItExist > 0 THEN
RETURN 1;
ELSE
RETURN 0;
END IF; /** vDoesItExist > 0 **/
END check_fg_id; -
Inserting a 'null' value in an IF THEN ELSE statement
Greetings,
I'm using Business Object webi XiR3
I'd like to return a 'null' value in certain cases for an IF THEN ELSE statement. Depending on if I format the field as a text or a number, I can return blanks ("") and zeros (0). However, what I really need to do is leave the field / column formatted as a number and return a 'null' value. You can see the variable below ... this will return a blank but the column is text.
Suggestions?
thanks.
variable:
=If([Comp Rate Mid] = 0 And( ([Market Rate 50th].085) - [Annual Total Targeted Comp] >=0) ; ([Market Rate 50th]0.85) - [Annual Total Targeted Comp]; If([Comp Rate Mid] <> 0 And( ([Comp Rate Mid] 0.85) - [Annual Total Targeted Comp] >=0) ; ([Comp Rate Mid]0.85) - [Annual Total Targeted Comp];""))I don't think this is possible using a formula, as formulas deal with content, and images can be placed in cells only as 'image fill', which is Format, rather than Content.
Might be possible using an AppleScript, but I'm not the person to advise you on that.
Regards,
Barry -
I have a form called myForm. On this form is a check box called myCheckBox. I also have a text box labeled myTextBox. I have assigned a macro, myMacro, to run upon selection/click of myCheckBox. The macro is an If statement which determines if myCheckBox
is checked or not checked and spits out a value, "Yes" or "No" for example, into the text box.
I am not able to get text to display into the text box although I am not receiving any errors when I run the macro. This may be a fault in my logic and would like help resolving where the problem lies. I am fairly new to Access so this could be something
simple.
My code is as follows:
If Forms!myForm = True Then
Forms!myForm!myTextBox.Value = "Yes!"
ElseIf Forms!myForm = False Then
Forms!myForm!myTextBox.Value = "No!"
Else
Forms!myForm!myTextBox.Value = " / ERROR / "
End if
Thanks!Hi,
This is the forum to discuss questions and feedback for Microsoft Office, the issue is more related to coding/programing, you'd better post your question to the MSDN forum for Access
http://social.msdn.microsoft.com/Forums/en-US/home?forum=accessdev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support -
IF THEN ELSE STATEMENT IN BeX Query designer
Hi,
I want to write a query as follows:
IF <Value a> is available THEN <Value a> ELSE <Value b>
I have written it as follows:
(X>0)X+(X<=0)Y
The problem with this equation is, in case X = 0(number Zero) then Y is not getting displayed. But In case X =NULL (or no values) then Y displayed. This is leading to inconsistency in final result. Please help in rectifying the formula incase it is incorrect or is it because of some program bug in BeX?
Regards
MadhavThis works for me...dont understand y its not working with u!!
it is simple:
(X<>0)X+(X==0)Y
If X is 0, then 0X + 1Y = Y
else
1X + 0Y = X.
What result you are getting in both cases?
as you thing,X value is may not be 0 in your case. It may be 0.00004...something like that...Set Decimal Places to 5 or 6 to X.
Message was edited by:
Muralidhar C -
Use If then else statement to display concatenated values
Hi,
I am trying to create a field which will display 2 different names depending on the status of another field.
Here is the code I have but it returns no data when I try it:
<?xdofx:if ReportStatus='Approved' then concatenate(DisplayFirstName, DisplayLastName) else concatenate(InvFirstName, InvLastName) end if?>
(Also I need to solve how to create a space between the first and last names)
Any help would be appreciated thanksUse the following.
<?choose:?>
<?when:ReportStatus='Approved' ?>
<?DisplayFirstName?> aspace <?DisplayLastName?> or <?concat(DisplayFirstName,' ', DisplayLastName)?>
<?end when?>
<?otherwise:?>
<? InvFirstName?> a space <? InvLastName?> or <?concat(InvFirstName,' ', InvLastName)?>
<?end otherwise?>
<?end choose?> -
[BIP Report] Could I use 'like' syntax inside if-then-else statement?
I have the following contents in my xml, I would like to show the amount of the ChargeAmount, only if the "Code" is starting from "WAF"in my table.
<Transaction>
<Account>A</Account>
<ChargeAmount>200</ChargeAmount>
<Code>WAF020</Code>
</Transaction>
<Transaction>
<Account>B</Account>
<ChargeAmount>250</ChargeAmount>
<Code>WAF003</Code>
</Transaction>
<Transaction>
<Account>C</Account>
<ChargeAmount>120</ChargeAmount>
<Code>WNL012</Code>
</Transaction>
<Transaction>
<Account>D</Account>
<ChargeAmount>200</ChargeAmount>
<Code>WNL002</Code>
</Transaction>
*** Note that the three digits after WAF is variable.
Display Table:
Account || ChargeAmount || Code
A|| 200 ||WAF020
B|| 250 ||WAF003
C|| NULL ||NULL
D|| NULL ||NULL
In the ChargeAmount column I tried the following syntax, however, both of them does not work well.
<?if: <xdoxslt:left(Code, 3)> = 'WAF' ?> then ChargeAmount else ' ' ?end if?>
<?xdofx if: Code = 'WAF?' ?> then ChargeAmount else ' ' ?end if?>
Could any expert provide work around for the above case?
Thanks!
ConnieIn the ChargeAmount column I tried the following syntax, however, both of them does not work well.
<?if: <xdoxslt:left(Code, 3)> = 'WAF' ?> then ChargeAmount else ' ' ?end if?>
<?xdofx if: Code = 'WAF?' ?> then ChargeAmount else ' ' ?end if?>
incorrect code will not work
not clear what do you want to do but try
<?xdoxslt:ifelse(xdoxslt:left(Code,3)='WAF',’yes’,’no’)?>
or
<?xdoxslt:ifelse(contains(Code, 'WAF'),’yes’,’no’)?> -
If then Else statement not working under Computation in APEX
Hi
Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
Page:
*Item Name (Value Required)
Type
Static Assignment
PL/SQL Function Body
SQL Query (return single value)
SQL Query (return colon separated value)
SQL Expression
PLSQL Expression
Item Value
Computation Point
*Sequence (Value Required)
Computation Point
On New Instance (new session)
Before Header
After Header
Before Region(s)
After Region(s)
Before Footer
After Footer
After Submit
Source
*Computation (Value Required)
BEGIN
IF :P3_AGING_DAYS <= '0' THEN
:P3_AGING_BUCKET := 'Within due date';
elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
:P3_AGING_BUCKET := 'Within 3 days';
end if;
end;1efb2968-171d-43f9-9d5d-d38151735ed7 wrote:
Please update your forum profile with a real handle instead of "1efb2968-171d-43f9-9d5d-d38151735ed7".
Can anyone help me where I am going wrong? I am trying to use the following code in Computation Process on Submit. I am not able to get the value. It's showing nothing.
BEGIN
IF :P3_AGING_DAYS <= '0' THEN
:P3_AGING_BUCKET := 'Within due date';
elsif :P3_AGING_DAYS > '0' AND :P3_AGING_DAYS <= '3' then
:P3_AGING_BUCKET := 'Within 3 days';
end if;
end;
A PL/SQL Function Body computation has to return a value rather than assigning it to an item in the PL/SQL block (APEX turns the block into the body of a function). The item for which the value is to be computed is specified in the computation properties (P3_AGING_BUCKET).
begin
return case
when :p3_aging_days < 1
then
'Within due date'
when :p3_aging_days between 1 and 3
then
'Within 3 days'
end;
end; -
Help with setting a condition (if-then-else statements)
Hello,
In the following data template I am trying to create a condition for
SUMAMOUNTPERKELEASE when cs_countfund > 1 in my rtf template.
<dataTemplate dataSourceRef="xmlpdemo" name="cs_ar_kelease">
<dataQuery>
<sqlStatement name="Q_1">
<![CDATA[
select fm.ke
, ltrim(to_char(fm.ke,'000')) || '-'
|| ltrim(to_char(fm.lease#,'000000')) || '-'
|| ltrim(to_char(fm.lse_code,'00')) kelease
, fm.ar_doc# ar_doc
, fd.fund
, fd.sub
, ro.lname
, fm.billed_from
, fm.billed_thru
, fm.due_date
, sum(decode(trancode,
10, fd.amount,
420, fd.amount,
421, fd.amount,
100, fd.amount*-1,
101, fd.amount*-1,
102, fd.amount*-1,
109, fd.amount*-1,
110, fd.amount*-1,
112, fd.amount*-1,
120, fd.amount*-1,
121, fd.amount*-1,
122, fd.amount*-1,
130, fd.amount*-1,
230, fd.amount*-1,
0 )) amount
from finhist_main fm
, rolodex ro
, finhist_detail fd
where fd.fund <> 999
and fd.sub <> 99
and fm.status not in (106,110,120)
and fd.trancode <> 11
and fm.ar_doc# < 9000000
and fm.rolodex# = ro.rolodex#
and fm.lse_code = fd.lse_code
and fm.lease# = fd.lease#
and fm.ke = fd.ke
and fm.ar_doc# = fd.ar_doc#
group by fm.ke
, fm.lease#
, fm.lse_code
, fm.ar_doc#
, fd.fund
, fd.sub
, ro.lname
, fm.billed_from
, fm.billed_thru
, fm.due_date
order by fm.ke, fm.lease#, fm.lse_code
, fm.ar_doc#
, fd.fund
, fd.sub
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_ke" dataType="varchar2" source="Q_1">
<element name="ke" dataType="number" value="KE"/>
<element name="SumamountPerke" function="sum" dataType="number" value="G_fund.amount"/>
<group name="G_kelease" dataType="varchar2" source="Q_1">
<element name="kelease" dataType="varchar2" value="KELEASE"/>
<element name="ar_doc" dataType="number" value="AR_DOC"/>
<element name="lname" dataType="varchar2" value="LNAME"/>
<element name="billed_from" dataType="date" value="BILLED_FROM"/>
<element name="billed_thru" dataType="date" value="BILLED_THRU"/>
<element name="due_date" dataType="date" value="DUE_DATE"/>
<element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
<element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/> <group name="G_fund" dataType="varchar2" source="Q_1">
<element name="fund" dataType="number" value="FUND"/>
<element name="sub" dataType="number" value="SUB"/>
<element name="amount" dataType="number" value="AMOUNT"/>
</group>
</group>
</group>
</dataStructure>
</dataTemplate>
<element name="CS_countfund" function="count" dataType="number" value="G_fund.fund"/>
<element name="SumamountPerkelease" function="sum" dataType="number" value="G_fund.amount"/>
I have tried the following conditions in the text form field for SUMAMOUNTPERKELEASE
<?if:cs_countfund > 1?>
SUMAMOUNTPERKELEASE
<?end if?>
<?xdofx: if :cs_countfund > 1 then
SUMAMOUNTPERKELEASE end if?>
<?xdofx: if cs_countfund > 1 then
SUMAMOUNTPERKELEASE end if?>
<?choose:?>
<?when: cs_countfund > 1?>
SUMAMOUNTPERKELEASE
<?end when?>
Nothing seems to work. Help...
Any suggestions would be greatly appreciated.
SusieHi,
I assume that in your resulting XML CS_countfund is written in uppercase.
So try
<?if:CS_COUNTFUND > 1?>
<?SUMAMOUNTPERKELEASE?>
<?end if?>
Regards
Rainer -
Charactersitic values to be used in IFTHEN ELSE STATEMENT IN QUERY
scenario: i need to use the characteristic values(not the attributes) to be used in an IF THEN ELSE STATEMENT in query. so i created a formula variable for the characteritic of processing type replacement path, replace with key.The values are not fetched in the result and is displayed as X.
what should i replace with key,lable, constant or other options whereas my requirement is the all the values present in the characteristc should be used.
eg. if char name is xyz and has the values 1,2,3,4,5 till -
20.
then in a calculated key figure :(formulavariable =1)* kefig1keyfig2 +not(formulavariable =1)kef2keyfig3.
this formula variable should have all the values of the characteristic values ie 1,2,3---20.
2. how should i do get the values of characterstics values in the equation give me the steps in detail..
3. i do not want to use the attributes, though i tried initally while creating the formual variable i replaced with attribute value, there is was an error and there were no reult.
i tried to create char. variable for the characteristic of manual entr , not ready for input values and gave all the values 1,2,3 --20 as default values and then created formaul variable and repalce with the variable, however this characteristic variable is not at all displayed from the list of variables which will be displayed while creating the formula variable.
help me out.
Thankshi srini,
i have includedthe char in rows. i want you to explain in detail how to use these values in the if then else statement in query.
i have created a calculated key figure 2= (formual variable =1 & keyfig a =0)* keyfig1kefig2 +not(formual variable =1 & keyfig a =0)keyfig2 *calculated keyfig1.
so this formula variable of replacement path have ref. to then char. and with what value should it replace, key, name, external char or attribut etc so that i should get the values of the char from 1 to20.
i donot to repalce with the attribute. i just want the char. values and not thier attributes (1. description 2. the second attribute has the values say abc1,efg2,ghi3 for respective charteristic values.
ie
char value desc 2nd attrib
1 hi abc1
2 bye defg2
3 ciao ghi3 -
Problem in If-Then-Else formula in report
Hello guys!
I use an If-Then-Else statement in a Calculated Key Figure (Cf. <a href="http://help.sap.com/saphelp_nw04s/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm">Conditional Calculations</a> ) and it works great with basic calculations.
I have a query (done in BI 7.0) where I display, for each calendar months (via 0CALMONTH), the usage (stored in a normal key figure in hours) of several products.
I need to take into account only the products that have been used for at least 60% of the time of the highest product for each month. I a single product, for a month, has been used less than 60% of the highest one, it should be considered as not being used at all (so the calculated usage would be = 0), otherwise, its usage is counted as normal.
In order to achieve this, I thought I would display the normal usage (the regular key figure) in column A, a calculated key figure that determines the MAXimum usage for each month in column B (which should be the same for all products) and another calculated key figure that displays the result of the If-Then-Else statement in column C.
In rows, I have 0CALMONTH and the products.
HOWEVER, when I do this, the result is incorrect. This is probably because to determine the MAX usage, I use a local calculation option, which displays the correct maximum usage on each row but it's not correct when used somewhere else.
<b>MY QUESTION IS: HOW can I display the maximum usage for a month on all rows without using the calculation option (and therefore would be correctly used by the If-Then-Else statement. I tried an aggregation exception but it doesn't really work (it works only on the total, but I need to do the calculation on each individual row).</b>
<u><b>Any useful comment will be greatly appreciated </b></u>
Thanks in advance!Hi Francal ,
Have you tried it . The constant selection will work if you have defined the calculated key figure correctly i.e. Aggreagtiomn "Max" with "product" as ref characteristic. Then you have to use this calculated key figure in your query , restrict it by "product" and make it a constant selection.
The calculated key figure it self will bring the highest usage for Month + product + ( any other characteristic you have in query ) but this will only apply to result . If you use constant seelction on top of it it will make sure that you see same value for all product for a particular month( and other characteristic combinations if you have ).
I have built similar queries and it works . By the way which versions of backend and frontend you have ??
Regards
Sanjay -
Nested if-then-else with double condition
Hi everybody, I tried to see on the forum how to build a complex if-then-else statement....but I didn't still find an answer
So, I'll explain my situation:
First I have to check if the field PROJ_DT_TO is null or not and then the language parameter:
1. if the field PROJ_DT_TO IS NULL then I have to check the language parameter:
a) if this last one is equal to 'English' I want to write inside my template 'Today',
b) if instead is equal to 'Greek' I want to write 'Σήμερα'
2. else if the field PROJ_DT_TO IS NOT NULL, again, I have to check the language parameter:
a) if this last one is equal to 'English' I have to write <?format-date:PROJ_DT_TO;'MMMM yyyy'?>
b) if instead is equal to 'Greek' I have to write <?format-date-and-calendar:PROJ_DT_FR;‘MMMM yyyy’;'GREGORIAN';'Europe/Athens'?>
I used the following syntax...but it didn't work...
<?choose@inlines:?>
<?when@inlines:PROJ_DT_TO=''?>
<?xdofx:if $p_language = 'Ελληνικά' then 'Σήμερα' else if $p_language = 'Αγγλικά' then 'Today' end if?><?end when?>
<?otherwise@inlines:?>
<?xdofx:if $p_language = 'Ελληνικά' then <?format-date-and-calendar:PROJ_DT_FR;‘MMMM yyyy’;'GREGORIAN';'Europe/Athens'?> else if $p_language = 'Αγγλικά' then <?format-date:PROJ_DT_TO;'MMMM yyyy'?> end if?>
<?end otherwise?>
<?end choose?>
The first piece, until the first <?end when?> instruction works....it's the <?otherwise@inlines:?> and the rest which doesn't work.....
If, instead, I use (without reaching my goal):
<?choose@inlines:?>
<?when@inlines:PROJ_DT_TO=''?><?xdofx:if $p_language = 'Ελληνικά' then 'Σήμερα' else if $p_language = 'Αγγλικά' then 'Today' end if?><?end when?>
<?otherwise@inlines:?>
<?format-date:PROJ_DT_TO;'MMMM yyyy'?><?end otherwise?>
<?end choose?>
I see the date PROJ_DT_TO even if always in the date format 'MMMM yyyy'
Anybody knows how can I rewrite my statement in order to reach the if-then-else situation I metioned above ?
Thanks in advance
Best Regards
AlexHi Vetsrini, thaks for your answer and your hint !!
I tried your code, but without the command 'when@inlines' doesn't work...
So I tried this :
<?choose@inlines:?>
<?when@inlines:PROJ_DT_TO=''?>
<?xdofx:if $p_language = 'Ελληνικά' then 'Σήμερα' else if $p_language = 'Αγγλικά' then 'Today' end if?>
<?end when?>
<?otherwise@inlines:?>
<?format-date:PROJ_DT_TO;'MMMM yyyy'?>
<?end otherwise?>
<?end choose?>
and It works..
But, look at this ! I discovered on the manual that inside the Preferences it's possible to set the Report Locale with the language you want.....and if I set my Report Locale in Greek, using the code above I correctly see all dates in Greek....but ALWAYS !!
I need to see dates in Greek or English dinamically according to the value of the parameter p_language passed inside the template at the beginnig (<?param@begin:p_language?>).
Even if inside the code there is the double condition ($planguage = 'Ελληνικά' or $p_language = 'Αγγλικά') for the two cases PROJ_DT_TO='' or PROJ_DT_TO !='', I see ALWAYS dates in the language set inside the Locale Report....
Is there a way to manipulate the Report Locale Setting and make it dinamic ?
Thanks in advance
Alex
So this preference is static, even if inside my report I have the parameter p_language I can see the data and headings with -
it is not very efficient, but nevertheless works.....
since xmlp is very limiting on the size of a statement, you need to keep it simple.....
Its better then using multiple if statements which is what we had to do in the past.
5.6.3 is supposed to have a if-then-else statement so can't wait to get there.....
here is the code....
<?choose:?>
<?when:sum(LINE_UNIT_SELLING_PRICE)<400?>LOW<?end when?>
<?when:sum(LINE_UNIT_SELLING_PRICE)>399 and sum(LINE_UNIT_SELLING_PRICE)<4000?>MED<?end when?>
<?otherwise:?>HIGH<?end otherwise?>
<?end chose?>other helpful syntax
<? format-date: @orderdate; 'DD-MMM-YYYY' ?>
<? format-number: ./price; 'L999G999D99' ?>
TOTAL ITEMS: <? count(items/item) ?> works like sql count
<? for-each:items/item ?> Item <?position() ?> <? end for-each?> works like sql rownum function
to set and get variables
Hope someone finds these useful....
Maybe you are looking for
-
MOVED: How to use 3tb hhd on Z97 gaming 3 motherboard
This topic has been moved to GAMING Motherboards. https://forum-en.msi.com/index.php?topic=249337.0
-
Audible or vibrating low battery alarm
is there any way to ask Apple that sets the low battery warning with an audible or vivrating alarm?
-
Problems facing when upgrading to 10.1.3.4
Hi All, We have upgraded the BPEL server from 10.1.3.3 to 10.1.3.4 also Upgraded the database from 10G to 10.2.0.4 We are facing the following exception in the BPEL while invoking the Other BPEL throught PartenerLink this BPEL worked fine in 10.1.3.3
-
Can I crop painted lines in Illustrator using pathfinder?
Hi everyone, This is a question from a total Illustrator newbie but I've been Googling like mad to no avail, so any help would be much appreciated! I'm experimenting with creating seamless patterns using shapes. I know how to crop shapes using the pa
-
On shut down I always get the message Program Not Responding. This happened before I installed Firefox. It does not pose a problem, that I know of, but it does concern me because I always have to End Program manually when I get this message. == Over