Alternative for StringBuffer
Hi,
In the DAO classes, we are using the StringBuffer to append various SQL statements based on the condition, hence there are so many append statements every where. Is there any other alternative we have
public List<Customer> getReport(String custType) {
StringBuffer strBuffer = new StringBuffer();
strBuffer.append("Select * from Customer cust");
if(custType.equals("HOME)){
strBuffer.append("where ......");
} else if(custType.equals("BUSINESS){
strBuffer.append("where ......");
)else if(custType.equals("NONE"){
strBuffer.append("where ......");
This is just a sample likewise we have many more, Is there anyway to optimize it through a design pattern?
Thanks
797836 wrote:
This is just a sample likewise we have many more, Is there anyway to optimize it through a design pattern?You are building SQL based on some dynamic input. Thus by definition it is and will remain dynamic.
So the question is what options are there to build it dynamically?
Options
1. Do it as you are doing it.
2. Use full length strings that reflect all of the possibilities. Unlikely to be a real solution because it involves too many possibilities.
3. Provide another construction idiom. This changes the specifics but not general idiom.
4. Generate the code.
Myself I would choose the last. You provide a source file that specifies each target case.
You have a compiler which takes the source file and emits java code, which produces basically exactly what you already have.
Changes then are a matter of changing the source file.
The complexity of this depends on the complexity of what you are doing. One should be cautious of attempting all cases if it appears the complexity level of some are too great. Doing the most complex manually might be more cost effective.
A sample source file could be a text file that looked like the following.
Statement: Select * from Customer cust
Field: HOME ...
Field: BUSINESS ...Naturally the cost here is in building the compiler.
Similar Messages
-
What is the alternative for DisplayMemberPath="Value" for Windows Store applications?
I think there is a bug with Windows Store Applications when it comes to using DisplayMemberPath="Value".
Here is my code
<ComboBox Height="40" VerticalAlignment="Stretch" SelectedValuePath="Key" DisplayMemberPath="Value" x:Name="comboBox1" FontSize="25"/>
var source = new Dictionary<string, double>();
source.Add("Item1", 0.4);
source.Add("Item2", 0.3);
source.Add("Item3", 0.1);
source.Add("Item4", 0.1);
var formateDSource = new Dictionary<string, string>();
foreach (var item in source)
formateDSource.Add(string.Format("[{0}, {1}]", item.Key, item.Value), item.Key);
comboBox1.ItemsSource = source;
If you use this code in WPF in works perfectly. However if you use this code in a Windows Store Application then the Combo Box is empty and an error is thrown. So is there an alternative way to do this in Windows Store Applications and have I unearthed a
bug? Because I have researched the Web for days and found no solution to this.*please do not comment unless you have tried my code as a Windows Store App not a WPF in Visual Studios. Can Someone post an example based on my code that works in Windows Store
Apps please because this is terrible.
ThanksIt looks like you got an answer on SO:
http://stackoverflow.com/questions/29817124/what-is-the-alternative-for-displaymemberpath-value-for-windows-store-applicat
This does look like a bug.
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces. -
What are the Flash alternatives for iphone and ipad?
Hello,
I would like to know what could be the Flash alternatives for iphone, ipod, and ipad. I would like to create iphone applications that have 3D animation I usually create with Flash.
But since Apple does not support the use of flash, I need to know what applications or programming languages I must use to create movies or animations for iphone or ipad.I would like to create iphone applications
Then you need to go here:
http://developer.apple.com/programs/iphone/ -
Alternative for AT NEW --- ENDAT
Hello experts,
I am using field-symbol as internal table. I cant use AT NEW statement inside this loop.
Can u pls provide alternative for above control break statement.
Thanks in advance.
Zak.Hi,
to use control break statement, first you should sort the internal table and then you use it.
Take one example:
data: begin of it9 occurs 4,
f1,
f2,
end of it9.
it9 = '1A'. append it9. "Fill it9 with data
it9 = '3A'. append it9.
it9 = '1B'. append it9.
it9 = '2B'. append it9.
sort it9 by f1.
loop at it9.
at new f1.
write: / 'start of:', it9-f1.
endat.
at end of f1.
write: / 'end of:', it9-f1.
endat.
endloop.
free it9.
Hope it is helpful.
Regards,
Chris Gu -
HT4597 what will be the new alternatives for iWeb publishing, Idisk & photo gallery ?
what will be the new alternatives for iWeb publishing, Idisk & photo gallery ?
Thanks for the reply that there will be 3rd party support.
One of the main reasons why I went from PC to Mac was because of all these cool features.
Am dissapointed to see them leave. ( Iweb, Photogallery, Idisk... ) -
Alternative for FM 'NAMETAB_GET'
Hi ,
Can any one suggest an alternative for the FM 'NAMETAB_GET' in 4.7.
Regards
ArunHi,
You did noyt specify why you want this alternative for.
Anyways, just check out RFC_GET_NAMETAB, which is also quite similar.
Regards,
Anand Mandalika. -
hello
In standard BOM for PP in T-code eg cs01 I can write alternative. But if I want to create WBS BOM with T-code cs71 I can't see such field for alternative. I checked in help.sap.com that alternative for WBS BOM are not used. I don't know why but there is not alternative filed in CS71.
So is there any other way to get alternatives for WBS BOM like modification, exit etc.
I checked SAP notes for this but I can't find.
Any help?hello
Thank you for your answers.
I have business process where I need WBS alternative. Why? Because of history of changes. My client wants to have 2 versions of one WBS BOM. One for history only and second for operative work. After some changes in WBS BOM and finish the project my client wants to analyse historical version which is created when project starts and the last operative version of the same WBS BOM.
@Uddhab
>If we prepare two BOM for a single WBS and attach the same in the WBS, then 2 requirement will flow and there will additional >quantity in the production.
Yes, if we attach. I want to attach only one WBS BOM so I don't multiply quantity. -
Hi
I am migrating my desktop from Windows 2000 to Redhat Linux 9.
I have been using third party tool TOAD for accessing the data from the database. As TOAD does not have a Linux setup, can any one suggest an alternative for the same.
Thanks in advance.
Manojyou are posting in the wrong forum.. this forum is for the Desktop Datacenter Oracle on Linux VMware kit..
you'll get better luck in other forums or better yet, Google.. I put toad and linux as keywords and got lots of hits on TOra.. so you might research that way..
good luck,
locking. -
Alternative for "FND FLEXSQL" in PLSQL
Hi All
I have a requirement to created a PLSQL based report for GL data, with range of GL CC as parameter. This could be achived in Oracle reports through user exit FND FLEXSQL.
But is there an alternative for FLEXSQL to be used in PLSQL. I came across a package FND_FLEX_ORACLE_REPORTS_APIS, but the no contents, it is set to return the message "'This API has not been implemented yet...';".
The version of the package is /* $Header: AFFFORAB.pls 120.1.12010000.1 2008/07/25 14:14:12 appldev ship $ */
Is there a newer version for this? or is there an alternative?Can u look into gl_flexfields_pkg and see if this helps.
Cheers,
ND -
Alternative for vmware workstation?
I am learning Application Packaging and it requires me to have a vmware workstaion in my machine. I am currently using MacBookPro Retina 15". Is it possible to install vmware workstation on Mac OS or is there any alternative for it? I would highly appreciate any suggestions.
Go to the VMWare website for that information. They have VM Fusion for the Mac, and I believe there is also a workstation version.
-
Alternative for HELPSCREEN_NA_CREATE
Hi
I am working on a update from 4.0b to 4.7 , on performing extended check on a program the FM HELPSCREEN_NA_CREATE is said to be obsolete , what could be the alternative for it.
Regards
ArunHi Christian,
The function module "HELPSCREEN_NA_CREATE" itself is calling the function "HELP_OBJECT_SHOW".
How can we go about calling this "help_object_show" function.
Regards
guru -
Alternative for RFC_READ_TABLE FM
Hello All,
SAP has asked not to use RFC_READ_TABLE function module (not to be used by SAPu2019s customers) directly or indirectly. Can anybody please suggest me what will be the alternative for this FM. Or what is the replacement for RFC_READ_TABLE FM?
Thanks in Advance.Hi,
you can use RFC_GET_TABLE_ENTRIES for the same -
TOAD has a nice, integrated feature called CodeXpert. It evaluates pl/sql code and recommends possible changes according to a set of programming rules and standards.
I'm trying to find an alternative for this feature in SqlDeveloper. Maybe a plug-in ?
Any suggestions ?I'm afraid there isn't, but you can always vote on the existing request for this at the SQL Developer Exchange, to add weight for possible sooner implementation. (I believe there is one, else create a new request)
Regards,
K. -
Hi Friends,
I am using JDeveloper 11.1.2 .In my application I need to achieve tab order. In adf I can't find the tab index.I need the alternative for tab index in adf.Any type of suggestions always welcome.
Thanks ,
Arun D.Hi..
Check
Controlling tab order in an ADF Form
http://blogs.oracle.com/shay/entry/controlling_tab_order_in_an_ad
How-to control the keyboard tab behavior in a LOV field
http://blogs.oracle.com/jdevotnharvest/entry/how-to_control_the_keyboard_tab_behavior_in_a_lov_field
ADF Faces setting the tab order between fields -
AlterNative for Script componant?
Hi all,
we are having Some Package.. we are using Script componant for generating surrogate key..
we are facing some prb using script componant.
so we need any other alternative for that.. plz response me
thanks in advance.
pandiyan
pandiyanHi pandiyan,
Based on your screenshot, the issue is that PerformUpgrade method failed.
To fix this issue, please refer to the following links:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/02cb6ff1-b380-42f7-afd5-da7629445dba/upgrading-packages-from-2005-to-2012-custom-components-and-delyavalidation-woes?forum=sqlintegrationservices
http://toddmcdermid.blogspot.in/2008/09/using-performupgrade.html
Thanks,
Katherine Xiong
Katherine Xiong
TechNet Community Support
Maybe you are looking for
-
SSL Protocol Error. Certificate is either invalid or common name...
There is only one website I have found that has this issue for us. It is collegesource.org. I have worked with their support but so far we have no solution. I have Windows Vista with IE7, Firefox 3.6 and chrome 4.0 and Adobe Reader 9.3. When I atte
-
Hi all! I have an iMac CD2 20" for 3 months. Yesterday at the bottom left corner appeared a yellowish stain. At first i thought it was a stain on the display. After cleaning with a lightly damped soft cloth the stain remained. Changing the background
-
IDOC Encryption in the transferring
Hi Buddies, I use IDOC->XI->IDOC to transfer the sales order through XI. There are some sensitive information in the SO IDOC, so I am wondering there is any way to encrypt the IDOC during the transferring. Appreciate any reply. Thanks. B'rgdz. Bu Ju
-
I have a large number of video files stored and I'd like to be able to view (and sort) a list of them in Finder, or similar, showing not just date & size etc but also some of the extended info, particularly video dimensions e.g. 1280x720 and audio ch
-
Hello, I recently just got a WiFi adapter for my Mac because my Mac's inbuilt one doesn't have that good range. I'm running Mavericks 10.9.5. When I plugged in the dongle, it did not light up and my Mac did not even recognize it, but when I plugged i