Goddam Curly Brackets!!!
HELP!
I'm having problems finding a missing or extra bracket within my code? Or at least I thik that is the problem.
The error I get is:
<----
270. try
542. }
--------^
*** Syntax Error: "Finally" inserted to complete TryStatement
I've tried using comparison software but it doesn't help!
I have attached the section of code that is causing the problem, but I think it may be deeped that just the following section.
All the brackes "seem" to match, but 271 goes to 501 in theory, but when I rightclick in my software (JCreator) and choose match bracket, it takes me to 531?
Anyhelp please!! Be most grateful!
See Attached Code:
try
//System.out.println("Here 1");
* Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
* I think this could be where LABEL should be a user configured variable (map)
* Either here or above on line 109. (map) (then again maybe not!!!)
if (label_tmp == null)
abortMissingInput("Activity Option 'LABELREF'");
System.out.println("Here 2");
else
// System.out.println("Here 3");
* Check to see if the nicelabel file already exists. If it does
* then we need to write the data into a temporary file.
// cam removed
// while(out.exists())
// cam removed
// System.out.println("Here 4");
* Build data for updating the next_number table. Before that happens we need to
* verify that the SFCs do not already exist in wip, if they do then we need to generate
* a new batch
/* map - Fix Rev 1.2 */
System.out.println("Label TMP "+label_tmp);
System.out.println("SFC Number "+SFCNumber);
if (label_tmp.equals("SB"))
/* map - Fix 1 Rev 1.2 */
System.out.println("Here 5");
requestConnection();
try
ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
nbBO = new NextNumberBOHandle(site,"S",itembo);
StringBuffer next_number_query = new StringBuffer();
next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
next_number_query.append("where HANDLE=");
next_number_query.append(wrap(nbBO));
Data number_query = executeQuery(next_number_query.toString());
current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
prefix = (String)number_query.get("PREFIX");
suffix = (String)number_query.get("SUFFIX");
long sfc_seq = current_seq.longValue();
first_sfc = current_seq.longValue();
int array_length = big.intValue();
* Build an array to create the next SFC numbers. This information will
* be used to select from the sfc table. If any of the SFCs in the array
* are found, a new block should be generated.
* I think this is where it implements the current sfc by 1. (map)
new_sfc = new String[array_length];
* map fix Rev 1.2 - loop until SFC_NBR test has been passed
System.out.println("Here 8a1");
if (Serialize == -1);
/* map added do statement */
do
//while (Serialize == -1);
System.out.println("Here 9");
* map fix Rev 1.2
for (int i=0;i<array_length;i++)
if (suffix == null)
new_sfc[i] = prefix+sfc_seq;
else
new_sfc[i] = prefix+sfc_seq+suffix;
sfc_seq++;
System.out.println(new_sfc);
* Using the data we have generated above we need to check the SFC table.
int new_sfc_array;
new_sfc_array = new_sfc.length;
for (int j=0;j<new_sfc_array;j++)
System.out.println("Here 10");
StringBuffer find_sfc = new StringBuffer();
find_sfc.append("SELECT count(*) from sfc where ");
find_sfc.append("sfc=");
find_sfc.append(wrap(new_sfc[j]));
System.out.println(find_sfc.toString());
AreYouThere = executeQuery(find_sfc.toString());
System.out.println("AreYouThere: "+AreYouThere);
there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
//int array_length = big.intValue();
System.out.println("Valueof There_count: "+there_count);
int test = there_count.intValue();
if (test > 0)
System.out.println("The sfc is already in use : "+new_sfc);
// We need a new block of sfc's one is already in use. Once we do that
BigDecimal doubled = new BigDecimal(2);
old_big = big;
big=big.multiply(doubled);
verify = true;
break;
if (Serialize == -1);
break;
// System.out.println("Data Returned from SFC select: "+AreYouThere);
Serialize = 0;
* map fix Rev 1.2
//this it my bracket below while searching for the missing one!!!!!!!!!!!
/* map added line below */
while (Serialize == -1);
* map fix Rev 1.2
current_seq = current_seq.add(big);
//System.out.println(now);
System.out.println("Update sequence number: "+current_seq);
// map commented this out as it is not set properly and will not compile.
//java.util.Date now = new java.util.Date();
//java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
//String time =formatter.format;
/* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
* to figure them out.
StringBuffer update_next_number = new StringBuffer();
update_next_number.append("UPDATE next_number set ");
update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
//update_next_number.append("modified_date_time="+wrap(time)+" ");
update_next_number.append("where HANDLE="+wrap(nbBO));
System.out.println("Update Next Number SQL: "+update_next_number);
System.out.println("Executing update");
executeUpdate(update_next_number.toString());
finally
cleanup();
/* map - Fix 1 */
System.out.println("After Allocate SFC");
/* map - Fix 1 */
/* This is where it actually writes the label and its contents.
* I also think its where it should be queuing the next label and not trying
* to overwrite it, like it does currently. (map)
//File out = new file(file_time)
/* map change Rev 1.3*/
//sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
/* This is the option to use the date as a time stamp.
SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
Date currentTime_1 = new Date();
fileDate = formatter.format(currentTime_1);
System.out.println("Current Time : "+fileDate);
file_path = ("C:\\TEMP\\"+fileDate+".Job");
out = new File(file_path);
System.out.println("Output File Name : "+out);
/* map change Rev 1.3*/
//map new code...
PrintWriter out = null;
try
out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
out.print("LABEL \"");
out.print(item);
out.print("_");
out.print(item_rev);
out.print("_");
out.print(label_tmp);
out.print(".lbl\"");
out.println();
// All other stuff...
finally
try
out.close();
catch(Exception e)
System.err.println("Unable to close output stream");
e.printStackTrace();
return inData;
Cheers, your a star!
The thing is, I have just been looking throughit after what you said and there seems to be only one catch and 3 trys and before I (fooked) around with it, it worked???
Here is the code. I think JCreator is not very helpful!!
Cheers
package com.genrad.app.core.prod.server;
import javax.ejb.*;
import java.rmi.RemoteException;
import javax.naming.*;
import javax.sql.DataSource;
import java.sql.*;
import java.math.*;
import java.io.*;
import java.lang.Thread.*;
import java.util.*;
import java.util.Date;
import java.text.*;
import javax.transaction.*;
import com.genrad.frame.*;
import com.genrad.app.common.server.*;
import com.genrad.app.nc.server.*;
import com.genrad.app.core.pd.server.*;
import com.genrad.app.core.sys.server.*;
import com.genrad.app.core.track.server.*;
import com.genrad.app.core.demand.server.*;
import com.genrad.app.core.env.server.*;
public class LexisBean extends BasicProductionBean implements SessionBean,LexisInterface
private final String ACTIVITY_ID = "CT520";
private final String TRUE = "true";
private String sfc_info = null;
private String get_prop_sfc = null;
private Data Context_List;
private Data test;
private Data itemBOrs;
private String item = null;
private String item_rev = null;
private String shoporder = null;
private Data LotSizeRS;
private Data results;
private Data hookData;
private Data AreYouThere;
private String printer = null;
private String label_tmp = null;
private BigDecimal big;
private BigDecimal current_seq;
private String site;
private String file_path;
private String file_time;
private String prefix;
private String suffix;
private boolean verify = false;
private NextNumberBOHandle nbBO;
private String[] new_sfc;
private int count=0;
private BigDecimal there_count;
private BigDecimal old_big;
private long first_sfc;
private int Serialize = -1;
private String fileDate;
//private PrintWriter out;
//private output_file;
// private StringBuffer buffer;
* Constructor
public LexisBean()
public Data execute(Data inData)throws RemoteException, BasicBOBeanException
* Need to get all the user options defined in the Activity. The only one that
* is not required in the printer name. There is no validation done on
* any of these options.
* Here I think it should be using the LABELREF User Argument in the Hook Activity
* within Resource Maintenance. (map)
String setting = null;
Utils.traceMsg("LexisBean . execute() : inData \n" + inData.toXMLString(), 10);
hookData = (Data)inData.get("HOOK_DATA",0);
Utils.traceMsg("LexisBean . execute() : hookData \n" + hookData.toXMLString(), 10);
results = (Data)hookData.get("ACTIVITY_OPTION", 0);
if (results != null)
String value = null;
String hookData = null;
Data countData = null;
* This should check the setting is not SB, don't pre-allocate SFC, just carry on
* and pass the current sfcnumber. This is my theory anyway!! (map)
for (int row = 0; row < results.size(); row++)
countData=results.extractRow(row);
setting = (String)countData.get("SETTING", 0);
value = (String)countData.get("EXEC_UNIT_OPTION", 0);
if (value != null && value.equals("PRINTER"))
printer = setting;
System.out.println("Printer: "+printer);
if (value != null && value.equals("LABELREF"))
System.out.println("Value: "+value);
label_tmp = setting;
System.out.println("Label TMP: "+label_tmp);
// Get the SFCBO, as that is the key to getting all the data we need.
Context_List = (Data)inData.get("CONTEXT_LIST",0);
item = (Context_List.get("CONTEXT_GBO",0)).toString();
sfc_info = (inData.get("SFC_BO")).toString();
//SFCBOInterface sfcBean = (SFCBOInterface)getEJB("SFCBO");
SFCBOHandle sfcbohand = (SFCBOHandle)inData.get("SFC_BO",0);
site = sfcbohand.getSite();
String SFCNumber = sfcbohand.getSFC();
// Need to grab the filename and full path from a system rule.
System.out.println("Fixing to try and get the Resource_BO");
ResourceBOHandle resource = (ResourceBOHandle)inData.get("RESOURCE_BO",0);
file_path = (String)getSystemRule("INLINE_PRINTING",site,resource);
File out = new File(file_path);
System.out.println("FilePath from resource "+file_path);
// Request connection to the database
requestConnection();
try
* Create a string buffer to build the SQL. Need to do this to
* get the itemBO from the SFC table. There currently is no method
* to get this information other than this. At lease not that I
* know of.
StringBuffer itemBOquery = new StringBuffer();
itemBOquery.append("SELECT ITEM_BO FROM SFC ");
itemBOquery.append("WHERE HANDLE=");
itemBOquery.append(wrap(sfcbohand));
itemBOrs = executeQuery(itemBOquery.toString());
System.out.println("ITEM BO FROM SELECT: "+itemBOrs);
ItemBOHandle itemBOHandle = new ItemBOHandle((String) itemBOrs.get("ITEM_BO"));
item = itemBOHandle.getItem();
item_rev = itemBOHandle.getRevision();
* Create a string buffer to build the SQL. Need to do this to get
* ShopOrderBO. This information is actually coming from the
* shop_order_sfc table. Once we have that it will be used to create
* the printjobname line in the label file.
StringBuffer soBOquery = new StringBuffer();
soBOquery.append("SELECT SHOP_ORDER_BO FROM shop_order_sfc ");
soBOquery.append("where SFC_BO=");
soBOquery.append(wrap(sfcbohand));
Data soBOrs = executeQuery(soBOquery.toString());
ShopOrderBOHandle shopBOHandle = new ShopOrderBOHandle((String) soBOrs.get("SHOP_ORDER_BO"));
shoporder = shopBOHandle.getShopOrder();
* Create a string buffer to build the SQL. Need to do this to get
* lotsize of an item. I will be getting this information from the
* item table. Once we have that information it will be used to
* create the PRINT line in the nicelabel.
* I think this is where it gets the item lot size and needs to get the sfc lot size,
* another one of Stuarts bugs...
StringBuffer LotSize = new StringBuffer();
LotSize.append("SELECT LOT_SIZE FROM ITEM ");
LotSize.append("where HANDLE=");
LotSize.append(wrap(itemBOHandle));
LotSizeRS = executeQuery(LotSize.toString());
big = (BigDecimal)LotSizeRS.get("LOT_SIZE");
System.out.println(LotSize.toString());
System.out.println("LOTSIZE: "+LotSizeRS);
finally
cleanup();
String sfc = sfcbohand.getSFC();
* The following try block is an attempt to write the information to
* the nice label file. It uses several of the string variables defined
* above.
try
//System.out.println("Here 1");
* Check to see if Activity Option 'LABEL' is present. If it is not throw an exception.
* I think this could be where LABEL should be a user configured variable (map)
* Either here or above on line 109. (map) (then again maybe not!!!)
if (label_tmp == null)
abortMissingInput("Activity Option 'LABELREF'");
System.out.println("Here 2");
else
// System.out.println("Here 3");
* Check to see if the nicelabel file already exists. If it does
* then we need to write the data into a temporary file.
// cam removed
// while(out.exists())
// cam removed
// System.out.println("Here 4");
* Build data for updating the next_number table. Before that happens we need to
* verify that the SFCs do not already exist in wip, if they do then we need to generate
* a new batch
/* map - Fix Rev 1.2 */
System.out.println("Label TMP "+label_tmp);
System.out.println("SFC Number "+SFCNumber);
if (label_tmp.equals("SB"))
/* map - Fix 1 Rev 1.2 */
System.out.println("Here 5");
requestConnection();
try
ItemBOHandle itembo = new ItemBOHandle(site,"*","*");
nbBO = new NextNumberBOHandle(site,"S",itembo);
StringBuffer next_number_query = new StringBuffer();
next_number_query.append("SELECT current_sequence,prefix,suffix from next_number ");
next_number_query.append("where HANDLE=");
next_number_query.append(wrap(nbBO));
Data number_query = executeQuery(next_number_query.toString());
current_seq = (BigDecimal)number_query.get("CURRENT_SEQUENCE");
prefix = (String)number_query.get("PREFIX");
suffix = (String)number_query.get("SUFFIX");
long sfc_seq = current_seq.longValue();
first_sfc = current_seq.longValue();
int array_length = big.intValue();
* Build an array to create the next SFC numbers. This information will
* be used to select from the sfc table. If any of the SFCs in the array
* are found, a new block should be generated.
* I think this is where it implements the current sfc by 1. (map)
new_sfc = new String[array_length];
* map fix Rev 1.2 - loop until SFC_NBR test has been passed
System.out.println("Here 8a1");
if (Serialize == -1);
/* map added do statement */
do
//while (Serialize == -1);
System.out.println("Here 9");
* map fix Rev 1.2
for (int i=0;i<array_length;i++)
if (suffix == null)
new_sfc[i] = prefix+sfc_seq;
else
new_sfc[i] = prefix+sfc_seq+suffix;
sfc_seq++;
System.out.println(new_sfc);
* Using the data we have generated above we need to check the SFC table.
int new_sfc_array;
new_sfc_array = new_sfc.length;
for (int j=0;j<new_sfc_array;j++)
System.out.println("Here 10");
StringBuffer find_sfc = new StringBuffer();
find_sfc.append("SELECT count(*) from sfc where ");
find_sfc.append("sfc=");
find_sfc.append(wrap(new_sfc[j]));
System.out.println(find_sfc.toString());
AreYouThere = executeQuery(find_sfc.toString());
System.out.println("AreYouThere: "+AreYouThere);
there_count = (BigDecimal)AreYouThere.get("COUNT(*)");
//int array_length = big.intValue();
System.out.println("Valueof There_count: "+there_count);
int test = there_count.intValue();
if (test > 0)
System.out.println("The sfc is already in use : "+new_sfc);
// We need a new block of sfc's one is already in use. Once we do that
BigDecimal doubled = new BigDecimal(2);
old_big = big;
big=big.multiply(doubled);
verify = true;
break;
if (Serialize == -1);
break;
// System.out.println("Data Returned from SFC select: "+AreYouThere);
Serialize = 0;
* map fix Rev 1.2
//this it my bracket below while searching for the missing one!!!!!!!!!!!
/* map added line below */
while (Serialize == -1);
* map fix Rev 1.2
current_seq = current_seq.add(big);
//System.out.println(now);
System.out.println("Update sequence number: "+current_seq);
// map commented this out as it is not set properly and will not compile.
//java.util.Date now = new java.util.Date();
//java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("dd-MM-yy");
//String time =formatter.format;
/* Update the next_number table. Should be doing this using the CRUD methods, but didn't have time
* to figure them out.
StringBuffer update_next_number = new StringBuffer();
update_next_number.append("UPDATE next_number set ");
update_next_number.append("current_sequence="+wrap(current_seq)); /*+", "); */
//update_next_number.append("modified_date_time="+wrap(time)+" ");
update_next_number.append("where HANDLE="+wrap(nbBO));
System.out.println("Update Next Number SQL: "+update_next_number);
System.out.println("Executing update");
executeUpdate(update_next_number.toString());
finally
cleanup();
/* map - Fix 1 */
System.out.println("After Allocate SFC");
/* map - Fix 1 */
/* This is where it actually writes the label and its contents.
* I also think its where it should be queuing the next label and not trying
* to overwrite it, like it does currently. (map)
//File out = new file(file_time)
/* map change Rev 1.3*/
//sb.append(order_id+","+pos_id+","+spcode+","+pack+","+imei_number+","+final_template);
/* This is the option to use the date as a time stamp.
SimpleDateFormat formatter = new SimpleDateFormat("ddMMyyHmmss");
Date currentTime_1 = new Date();
fileDate = formatter.format(currentTime_1);
System.out.println("Current Time : "+fileDate);
file_path = ("C:\\TEMP\\"+fileDate+".Job");
out = new File(file_path);
System.out.println("Output File Name : "+out);
/* map change Rev 1.3*/
//map new code...
PrintWriter out = null;
try
out = new PrintWriter(new BufferedOutputStream(new FileOutputStream("c:/temp/nice.job", true)), true);
out.print("LABEL \"");
out.print(item);
out.print("_");
out.print(item_rev);
out.print("_");
out.print(label_tmp);
out.print(".lbl\"");
out.println();
// All other stuff...
finally
try
out.close();
catch(Exception e)
System.err.println("Unable to close output stream");
e.printStackTrace();
return inData;
Similar Messages
-
Hi guys, here' my problem:
Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set-DhcpServerv4OptionValue -ScopeId 172.19.2.0 -Value {0x35, 0x35, 0x32}
work just fine from the powershell prompt.
Import-Csv .\Nodi.csv -Delimiter ";" | foreach {
if ($_.Value -ne "-") {
Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set-DhcpServerv4OptionValue -ScopeId $_.ScopeID -Value $_.Value
Doesn't work:
Set-DhcpServerv4OptionValue : Parameters for option value to be set for option ID 132 do not match with option definition on DHCP server SAGA.
At C:\dhcpscripts\Set-ScopeOption43.ps1:6 char:78
+ Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 | Set ...
+
~~~
+ CategoryInfo : InvalidArgument: (132:root/Microsoft/...erv4OptionValue) [Set-DhcpServerv4OptionValue], CimException
+ FullyQualifiedErrorId : WIN32 87,Set-DhcpServerv4OptionValue
CSV contents:
ScopeId,Value
172.19.2.0,{0x35, 0x35, 0x32}
172.19.3.0,{0x35, 0x35, 0x33}
172.19.4.0,{0x35, 0x35, 0x34}
If I change, in the script, $_.Value with, for example, {0x35, 0x35, 0x32} it works. The problem is passing the value from the CSV file. When inserting Write-Host $_.Value in the script, it display the values correctly with curly brackets.
Any suggestion?
Dario PalermoCouple of things to note here:
The -Value parameter of the Set-DhcpServer4OptionValue cmdlet accepts an array of strings.
When you type something in curly braces in a PowerShell script (if it's not in quotation marks), you're typically defining a ScriptBlock object. The literal syntax for these is { <Statements> }.
When you import a CSV file, you're getting strings. Strings that happen to contain curly braces are still just strings.
When you convert a ScriptBlock object into a string, the curly braces are not included in the string output; only the statements inside it.
Your Import-Csv command mentions a delimiter of ";", but your sample CSV contents have separated the ScopeId and Value fields with commas. I assume that this was meant to be a semicolon, but commas within the curly braces.
Is this correct?
With this in mind, when you run the command locally with -Value { 0x01, 0x02, 0x03 } , what PowerShell is really passing to the command is a string value of " 0x01, 0x02, 0x03 "; the ScriptBlock literal you wrote is converted directly to a string
for you. If you ran the command with -Value "{ 0x01, 0x02, 0x03 }", you'd probably get the same error that you're seeing during the CSV import.
In order to make this work, you'll need to strip out the curly braces from the CSV data (either directly in the file, or at the time of import; doesn't matter), before calling Set-DhcpServer4OptionValue. Try this:
Import-Csv .\Nodi.csv -Delimiter ";" | foreach {
if ($_.Value -ne "-") {
$value = $_.Value -replace '^\s*{\s*|\s*}\s*$'
Get-DhcpServerv4OptionValue -ScopeId 172.19.1.0 -all -OptionId 132 |
Set-DhcpServerv4OptionValue -ScopeId $_.ScopeID -Value $value
This removes the curly braces (and any leading / trailing whitespace, for good measure) from the input data before passing the string on to Set-DhcpServer4OptionValue. -
Curly brackets - can't activate key "8" and "9" with alt+shift ?
Hi I am using danish keys on my mac book pro and can't activate the keys 8 and 9 with alt+shift, wherefore I can't easily make curly brackets ?
Have any of you had same problem or do you know a way around it ?
I know I kan draw a curly bracket, but it is time consuming.
So if any of you know a trick - I will be thankful.
BRSounds as if you are misunterstanding me.
Glyphs are under the Type menu. There you can see all the characters in the selected font.
With your type active using the Type tool, just double click on the character you want in the Glyphs palette and it will show up. -
Format curly brackets in an exitising project
Hi
I have a semi big project, where the brackets style is all messed up, different syles all over the place.
I worked in FDT long time ago. Here there was a place where you could format the brackets in exitisting files. (Not talking about the new code i write but exitisting)
I found an addon called flex formater, but I dont seem to be able to change exitisting code.
Any ideas?Hi thanks for your answer, but that only correct indentation, that not helping with the brackets.
This is how much of the code is:
someFunciton()
blah;
somOtherFunciton(){
blah;
This is how I would like it to be.
someFunciton()
blah;
somOtherFunciton()
blah; -
Bug report: text between curly brackets deleted when posting via e-mail
Title says it all.
For example, this happened to me here: http://forums.adobe.com/message/2996053report message
CALL METHOD lo_message_manager->report_error_message
EXPORTING
message_text = lv_message_string.
EXIT.
your EXIT statement will get you out of the loop. rest of the records in internal table will nto be read -
No curly or square brackets in xorg in Swedish keyboard layout
Hi!
I'm using the Swedish keyboard layout in xorg (se), but the curly och square brackets does not seem to be displayed as they should.
When I enter AltGr + 7, I should get a curly bracket ( { ), but now it gives me a û. AltGr + 8 equals a Û (should be [ ), AltGr + 9 equals ý (should be ] ) and AltGr + 0 equals Ý (should be } ).
Here's my xorg.conf for the Keyboard input device:
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "logiultrax"
Option "XkbLayout" "se"
EndSection
Anyone have a clue what's going on?
Last edited by mei (2009-02-03 00:23:18)mei wrote:
Hi!
I'm using the Swedish keyboard layout in xorg (se), but the curly och square brackets does not seem to be displayed as they should.
When I enter AltGr + 7, I should get a curly bracket ( { ), but now it gives me a û. AltGr + 8 equals a Û (should be [ ), AltGr + 9 equals ý (should be ] ) and AltGr + 0 equals Ý (should be } ).
Here's my xorg.conf for the Keyboard input device:
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "logiultrax"
Option "XkbLayout" "se"
EndSection
Anyone have a clue what's going on?
Check your /etc/rc.conf so that you've set your locale and keymap right, that part of my rc.conf:
LOCALE="sv_SE.UTF-8"
HARDWARECLOCK="UTC"
USEDIRECTISA="no"
TIMEZONE="Europe/Stockholm"
KEYMAP="sv-latin1"
As for xorg.conf, I'm actually running completely without it. Which I could recommend as long as you're not using the proprietary drivers from NVidia or ATI or so. -
ABAP Help .. What does those brackets means
hi,
I am learning sap abap and trying to use f1 on certain key words, I am unable to understand even simple statements because of lot of brackets.
What those brackets means ?? Please let me know. may be this is silly, I am sorry about my ignorance.
Regards
madhu.Hi Venkat,
Please check these.
Vertical lines | between parts of statements mean that only one of the parts listed within a statement must be used. Lines are not a part of ABAP syntax.
Example:
DDMMYY | MMDDYY | YYMMDD
Curly brackets { } group together related parts of statements, for example, on the right or left of vertical lines. Curly brackets are not part of ABAP syntax.
Example:
{NO EDIT MASK}|{EDIT MASK mask}
Regards,
Ferry Lianto -
HOW TO system.out.PRINT a curly brace: {
How is it possible to print a { with command: system.out.print{ "text { text"}; ?
ThanksHow is it possible to print a { with command:
system.out.print{ "text { text"}; ?
ThanksYour command has 2 errors in it.
1) "system" must start with a capital "S"
2) You used curly brackets where you should have used parentheses
This works: System.out.print( "text { text");
(although I suspect that you really want to use println, not print) -
Notation in L8 - chord symbols and brackets
Hello again -
I've seen this question a couple of times, and wondered if anyone yet had an answer/workaround... The chord symbols in L8 seem a bit ugly - I can change the font fine, but is there any way I can:
1 - bring the 7 part of a G7 chord more in line with the G? It seems so high as to be almost disconnected from the chord!
2 - reduce the overall size of the symbol in a G-over-D type chord?
Also, I'm working on very simple piano/vocal parts and am getting the hang of joining them together, but at the moment I can't seem to get rid of a bracket that is joining all three staves together. What I want is all three staves joined at the beginning of each line by a single thin line (like a bar line), then the two piano staves joined by a curly bracket. At the moment I have this, but there is an additional thick, straight bracket (almost like a repeat sign without the dots) that I don't want. How do I get rid of it?
Thanks!
JoeI've solved my first problem - RTFM! - and have found the chord editing box, but now have a new problem. I have a pause sign over the final chord, and it's slightly out of alignment, and I don't seem to be able to select it independently of the note it is attached to?
-
Dynamic CRM 2013 Online how to execute Report, generate PDF and email
Dear All,
I am using Dynamic CRM 2013 online. For quote, I have workflow and Dialogue processes for review process. On approval, I want the system to generate a PDF of quote report, attach the PDF and email it to the Customer.
Better I would like, When approver, clicks on the approve button, the system should auto generate a PDF of quote report, attach the PDF and email it to the Customer, without any further input from the user. If its not possible, I may have to put button on
quote form.
I am using the attached code, but facing various issues.
1. Under prepare the SOAP Message coding part, I am not sure what should be the below URL for CRM 2013 Online?
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
2. What should be the emailid here? Is it Recepient Contact id(Guid) ?
var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
alert("emailid" + emailid.toString());
3. Using this code, not able to create Entity for "ActivityMimeAttachment", I am getting newEntity as undefined.
Below is the code I am using. Please check and help me out, where I am going wrong. Let me know if any better way to implement it. At present, I have put one button on quote form, on click event, below code will get executed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
var Xrm;
if (window.opener) { Xrm = window.opener.Xrm; }
else if (window.parent) { Xrm = window.parent.Xrm; }
function getReportingSession() {
var reportName = "Quotation_Report"; //set this to the report you are trying to download
var reportId = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
var recordid = Xrm.Page.data.entity.getId();
// recordid = recordid.substring(1, 37); //getting rid of curly brackets
alert(recordid);
var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
var retrieveEntityReq = new XMLHttpRequest();
retrieveEntityReq.open("POST", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
retrieveEntityReq.send("id=%7B" + reportId + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" + reportName + "&isScheduledReport=false");
var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
var ret = new Array();
ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
x = retrieveEntityReq.responseText.indexOf("ControlID=");
ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
return ret;
function createEntity(ent, entName, upd) {
var jsonEntity = JSON.stringify(ent);
var createEntityReq = new XMLHttpRequest();
var ODataPath = Xrm.Page.context.getServerUrl() + "XRMServices/2011/OrganizationData.svc";
createEntityReq.open("POST", ODataPath + "/" + entName + "Set" + upd, false);
createEntityReq.setRequestHeader("Accept", "application/json");
createEntityReq.setRequestHeader("Content-Type", "application/json; charset=utf-8");
createEntityReq.send(jsonEntity);
var newEntity = JSON.parse(createEntityReq.responseText).d;
alert("new entity" + newEntity);
return newEntity;
function createAttachment() {
var params = getReportingSession();
var recordid = Xrm.Page.data.entity.getId();
alert("recordid " + recordid);
var orgName = Xrm.Page.context.getOrgUniqueName();
var userID = Xrm.Page.context.getUserId();
//create email record
// Prepare the SOAP message.
var xml = "<?xml version='1.0' encoding='utf-8'?>" +"<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'" +
" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'" +
" xmlns:xsd='http://www.w3.org/2001/XMLSchema'>" +
"<soap:Header>" +
"</soap:Header>" +
"<soap:Body>" +
"<Create xmlns='http://schemas.microsoft.com/crm/2007/WebServices'>" +
"<entity xsi:type='email'>" +
"<regardingobjectid type='quote'>" + recordid + "</regardingobjectid>" +
"<subject>" + "Email with Attachment4" + "</subject>" +
"</entity>" +
"</Create>" +
"</soap:Body>" +
"</soap:Envelope>";
// Prepare the xmlHttpObject and send the request.
var xHReq = new ActiveXObject("Msxml2.XMLHTTP");
xHReq.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xHReq.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/Create");
xHReq.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xHReq.setRequestHeader("Content-Length", xml.length);
xHReq.send(xml);
// Capture the result
var resultXml = xHReq.responseXML;
// alert("resultXml " + resultXml);
// Check for errors.
var errorCount = resultXml.selectNodes('//error').length;
if (errorCount != 0) {
alert("ERROR");
var msg = resultXml.selectSingleNode('//description').nodeTypedValue;
alert(msg);
var emailid = resultXml.selectSingleNode("//CreateResult").nodeTypedValue;
alert("emailid" + emailid.toString());
//var emailid = userID;
var post = Object();
post.Body = encodePdf(params);
var email = new Array();
email[0] =new Object();
email[0].id = emailid;
email[0].entityType ='email';
post.Subject ="File Attachment";
post.AttachmentNumber = 1;
post.FileName ="Report.pdf";
post.MimeType ="application/pdf";
post.ObjectId = Object();
post.ObjectId.LogicalName ="email";
post.ObjectId.Id = email[0].id;
post.ObjectTypeCode ="email";
alert(post.ObjectId.Id);
createEntity(post,"ActivityMimeAttachment", "");
alert("created successfully");
email.Subject = "Your Order";
//Set The current order as the Regarding object
email.RegardingObjectId = {
Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
//Create Email Activity
SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
// Email Call Back function
function EmailCallBack(result) {
email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
var activityPartyFrom = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyFrom.PartyId = {
Id: customerId, // id of entity you want to associate this activity with.
LogicalName: "contact"
// Set the "activity" of the ActivityParty
activityPartyFrom.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity).
activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
// Create the from ActivityParty for the email
SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
var activityPartyTo = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyTo.PartyId = {
Id: ownerId, // id of entity you want to associate this activity with.
LogicalName: "systemuser"
// Set the "activity" of the ActivityParty
activityPartyTo.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity). activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
// Create the from ActivityParty
SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
//ActivityParty From Callback
function ActivityPartyFromCallBack(result) {
//ActivityParty To Callback
function ActivityPartyToCallBack(result) {
var StringMaker = function () {
this.parts = [];
this.length = 0;
this.append = function (s) {
this.parts.push(s);
this.length += s.length;
this.prepend = function (s) {
this.parts.unshift(s);
this.length += s.length;
this.toString = function () {
return this.parts.join('');
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function encode64(input) {
var output = new StringMaker();
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
while (i < input.length) {
chr1 = input[i++];
chr2 = input[i++];
chr3 = input[i++];
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
else if (isNaN(chr3)) {
enc4 = 64;
output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
return output.toString();
var bdy = new Array();
var bdyLen = 0;
function concat2Bdy(x) {
bdy[bdyLen] = x;
bdyLen++;
function encodePdf(params) {
bdy = new Array();
bdyLen = 0;
var retrieveEntityReq = new XMLHttpRequest();
var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] + "&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] + "&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
retrieveEntityReq.open("GET", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.send();
BinaryToArray(retrieveEntityReq.responseBody);
return encode64(bdy);
</SCRIPT>
<SCRIPT type=text/vbscript>
Function BinaryToArray(Binary)
Dim i
ReDim byteArray(LenB(Binary))
For i = 1 To LenB(Binary)
byteArray(i-1) = AscB(MidB(Binary, i, 1))
concat2Bdy(AscB(MidB(Binary, i, 1)))
Next
BinaryToArray = byteArray
End Function
</SCRIPT>
</head>
<body>
<input type="button" onclick="createAttachment();" value="Attach Report" />
</body>
</html>
Thanks. and waiting for your valuable comments.
- MittalHello,
Yes, I was able to make my code working as below. Tested on CRM online 2013.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
<script type="text/javascript">
if (typeof (SDK) == "undefined")
{ SDK = { __namespace: true }; }
SDK.JScriptRESTDataOperations = {
_context: function () {
if (typeof GetGlobalContext != "undefined")
{ return GetGlobalContext(); }
else {
if (typeof Xrm != "undefined") {
return Xrm.Page.context;
else { return new Error("Context is not available."); }
_getServerUrl: function () {
var serverUrl = this._context().getServerUrl()
if (serverUrl.match(/\/$/)) {
serverUrl = serverUrl.substring(0, serverUrl.length - 1);
return serverUrl;
_ODataPath: function () {
return this._getServerUrl() + "/XRMServices/2011/OrganizationData.svc/";
_errorHandler: function (req) {
return new Error("Error : " +
req.status + ": " +
req.statusText + ": " +
JSON.parse(req.responseText).error.message.value);
_dateReviver: function (key, value) {
var a;
if (typeof value === 'string') {
a = /Date\(([-+]?\d+)\)/.exec(value);
if (a) {
return new Date(parseInt(value.replace("/Date(", "").replace(")/", ""), 10));
return value;
Create: function (object, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 201) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send(JSON.stringify(object));
Retrieve: function (id, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("GET", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 200) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
Update: function (id, object, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("X-HTTP-Method", "MERGE");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 204 || this.status == 1223) {
successCallback();
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send(JSON.stringify(object));
Delete: function (id, type, successCallback, errorCallback) {
var req = new XMLHttpRequest();
req.open("POST", this._ODataPath() + type + "Set(guid'" + id + "')", true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("X-HTTP-Method", "DELETE");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 204 || this.status == 1223) {
successCallback();
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
RetrieveMultiple: function (type, filter, successCallback, errorCallback) {
if (filter != null) {
filter = "?" + filter;
else { filter = ""; }
var req = new XMLHttpRequest();
req.open("GET", this._ODataPath() + type + "Set" + filter, true);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.onreadystatechange = function () {
if (this.readyState == 4 /* complete */) {
if (this.status == 200) {
successCallback(JSON.parse(this.responseText, SDK.JScriptRESTDataOperations._dateReviver).d.results);
else {
errorCallback(SDK.JScriptRESTDataOperations._errorHandler(this));
req.send();
__namespace: true
</script>
<script type="text/javascript">
//Create Email and link it with Order as Regarding field
var Xrm;
var email = new Object();
var ownerID = "";
var CustomerId = "";
if (window.opener) { Xrm = window.opener.Xrm; }
else if (window.parent) { Xrm = window.parent.Xrm; }
//Get ownerid who send email of quotation to customer
function GetOwnerID() {
var owner = Xrm.Page.getAttribute("ownerid").getValue();
ownerID = owner[0].id;
var ownerName = owner[0].name;
var entityType = owner[0].entityType;
GetToEmailGUID();
//Get customerid who receive email of quotation from owner
function GetToEmailGUID() {
var Customer = Xrm.Page.getAttribute('customerid').getValue();
CustomerId = Customer[0].id;
var CustomerName = Customer[0].name;
var entityType = Customer[0].entityType;
//if CustomerId is type of "Account" then get Primary Contact id of that account
if (entityType == "account") {
var contact = Xrm.Page.getAttribute("customerid").getValue();
if (contact === null) return;
var serverUrl = Xrm.Page.context.getClientUrl();
var oDataSelect = serverUrl + "/XRMServices/2011/OrganizationData.svc/AccountSet(guid'" + contact[0].id + "')?$select=PrimaryContactId";
var req = new XMLHttpRequest();
req.open("GET", oDataSelect, false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json;charset=utf-8");
req.onreadystatechange = function () {
if (req.readyState === 4) {
if (req.status === 200) {
var retrieved = JSON.parse(req.responseText).d;
CustomerId = retrieved.PrimaryContactId.Id;
else {
alert(this.statusText);
req.send();
function CreateEmail() {
GetOwnerID();
email.Subject = "Email with Report Attachment";
//Set The current order as the Regarding object
email.RegardingObjectId = {
Id: Xrm.Page.data.entity.getId(), //Get the current entity Id , here OrderId
LogicalName: Xrm.Page.data.entity.getEntityName()//Get the current entity name, here it will be “salesOrder”
//Create Email Activity
SDK.JScriptRESTDataOperations.Create(email, "Email", EmailCallBack, function (error) { alert(error.message); });
// Email Call Back function
function EmailCallBack(result) {
email = result; // Set the email to result to use it later in email attachment for retrieving activity Id
var activityPartyFrom = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyFrom.PartyId = {
Id: CustomerId, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
LogicalName: "contact"
// Set the "activity" of the ActivityParty
activityPartyFrom.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity).
activityPartyFrom.ParticipationTypeMask = { Value: 2 }; // 2 means ToRecipients
// Create the from ActivityParty for the email
SDK.JScriptRESTDataOperations.Create(activityPartyFrom, "ActivityParty", ActivityPartyFromCallBack, function (error) { alert(error.message); });
var activityPartyTo = new Object();
// Set the From party of the ActivityParty to relate an entity with Email From field
activityPartyTo.PartyId = {
Id: ownerID, //"79EBDD26-FDBE-E311-8986-D89D6765B238", // id of entity you want to associate this activity with.
LogicalName: "systemuser"
// Set the "activity" of the ActivityParty
activityPartyTo.ActivityId = {
Id: result.ActivityId,
LogicalName: "email"
// Now set the participation type that describes the role of the party on the activity).
activityPartyTo.ParticipationTypeMask = { Value: 1 }; // 1 means Sender
// Create the from ActivityParty
SDK.JScriptRESTDataOperations.Create(activityPartyTo, "ActivityParty", ActivityPartyToCallBack, function (error) { alert(error.message); });
//ActivityParty From Callback
function ActivityPartyFromCallBack(result) {
//ActivityParty To Callback
function ActivityPartyToCallBack(result) {
GetReportId('Quotation');
//Create attachment for the created email
function CreateEmailAttachment() {
//get reporting session and use the params to convert a report in PDF
var params = getReportingSession();
//Email attachment parameters
var activitymimeattachment = Object();
activitymimeattachment.ObjectId = Object();
activitymimeattachment.ObjectId.LogicalName = "email";
activitymimeattachment.ObjectId.Id = email.ActivityId;
activitymimeattachment.ObjectTypeCode = "email",
activitymimeattachment.Subject = "File Attachment";
activitymimeattachment.Body = encodePdf(params);
activitymimeattachment.FileName = "Report.pdf";
activitymimeattachment.MimeType = "application/pdf";
//Attachment call
SDK.JScriptRESTDataOperations.Create(activitymimeattachment, "ActivityMimeAttachment", ActivityMimeAttachmentCallBack, function (error) { alert(error.message); });
//ActivityMimeAttachment CallBack function
function ActivityMimeAttachmentCallBack(result) {
var features = "location=no,menubar=no,status=no,toolbar=no,resizable=yes";
var width = "800px";
var height = "600px";
window.open(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", features);
// To open window which works in outlook and IE both
//openStdWin(Xrm.Page.context.getServerUrl() + "main.aspx?etc=" + 4202 + "&pagetype=entityrecord&id=" + email.ActivityId, "_blank", width, height, features);
//This method will get the reportId based on a report name that will be used in getReportingSession() function
function GetReportId(reportName) {
var oDataSetName = "ReportSet";
var columns = "ReportId";
var filter = "Name eq '" + reportName + "'";
retrieveMultiple(oDataSetName, columns, filter, onSuccess);
function retrieveMultiple(odataSetName, select, filter, successCallback) {
var serverUrl = Xrm.Page.context.getServerUrl();
var ODATA_ENDPOINT = "/XRMServices/2011/OrganizationData.svc";
var odataUri = serverUrl + ODATA_ENDPOINT + "/" + odataSetName + "?";
if (select) {
odataUri += "$select=" + select + "&";
if (filter) {
odataUri += "$filter=" + filter;
$.ajax({
type: "GET",
contentType: "application/json; charset=utf-8",
datatype: "json",
url: odataUri,
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json");
success: function (data) {
if (successCallback) {
if (data && data.d && data.d.results) {
successCallback(data.d.results);
else if (data && data.d) {
successCallback(data.d);
else {
successCallback(data);
error: function (XmlHttpRequest, errorThrown) {
if (XmlHttpRequest && XmlHttpRequest.responseText) {
alert("Error while retrieval ; Error – " + XmlHttpRequest.responseText);
function onSuccess(data) {
reportId = data[0].ReportId.replace('{', ").replace('}', ");
CreateEmailAttachment(); // Create Email Attachment
//Gets the report contents
function getReportingSession() {
var pth = Xrm.Page.context.getServerUrl() + "/CRMReports/rsviewer/reportviewer.aspx";
var retrieveEntityReq = new XMLHttpRequest();
var Id = Xrm.Page.data.entity.getId();
var quotationGUID = Id.replace('{', ""); //set this to selected quotation GUID
quotationGUID = quotationGUID.replace('}', "");
var reportName = "Quotation"; //set this to the report you are trying to download
var reportID = "7C39D18F-1DC6-E311-8986-D89D6765B238"; //set this to the guid of the report you are trying to download
var rptPathString = ""; //set this to the CRMF_Filtered parameter
var strParameterXML = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'><entity name='quote'><all-attributes /><filter type='and'><condition attribute='quoteid' operator='eq' uitype='quote' value='" + quotationGUID + "' /> </filter></entity></fetch>";
retrieveEntityReq.open("POST", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
rptPathString = "id=%7B" + reportID + "%7D&uniquename=" + Xrm.Page.context.getOrgUniqueName() + "&iscustomreport=true&reportnameonsrs=&reportName=" +
reportName + "&isScheduledReport=false&p:CRMAF_Filteredquote=" + strParameterXML;
//remove the part starting from &p:salesorderid if your report has no parameters
retrieveEntityReq.send(rptPathString);
var x = retrieveEntityReq.responseText.indexOf("ReportSession=");
var ret = new Array();
ret[0] = retrieveEntityReq.responseText.substr(x + 14, retrieveEntityReq.responseText.indexOf("&", x) - x - 14); //the session id
x = retrieveEntityReq.responseText.indexOf("ControlID=");
ret[1] = retrieveEntityReq.responseText.substr(x + 10, retrieveEntityReq.responseText.indexOf("&", x) - x - 10); //the control id
return ret;
var bdy = new Array();
var bdyLen = 0;
function concat2Bdy(x) {
bdy[bdyLen] = x;
bdyLen++;
function encodePdf(params) {
bdy = new Array();
bdyLen = 0;
var retrieveEntityReq = new XMLHttpRequest();
var pth = Xrm.Page.context.getServerUrl() + "/Reserved.ReportViewerWebControl.axd?ReportSession=" + params[0] +
"&Culture=1033&CultureOverrides=True&UICulture=1033&UICultureOverrides=True&ReportStack=1&ControlID=" + params[1] +
"&OpType=Export&FileName=Public&ContentDisposition=OnlyHtmlInline&Format=PDF";
retrieveEntityReq.open("GET", pth, false);
retrieveEntityReq.setRequestHeader("Accept", "*/*");
retrieveEntityReq.send();
BinaryToArray(retrieveEntityReq.responseBody);
return encode64(bdy);
var StringMaker = function () {
this.parts = [];
this.length = 0;
this.append = function (s) {
this.parts.push(s);
this.length += s.length;
this.prepend = function (s) {
this.parts.unshift(s);
this.length += s.length;
this.toString = function () {
return this.parts.join('');
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function encode64(input) {
var output = new StringMaker();
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
while (i < input.length) {
chr1 = input[i++];
chr2 = input[i++];
chr3 = input[i++];
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
output.append(keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4));
return output.toString();
</script>
<script type="text/vbscript">
Function BinaryToArray(Binary)
Dim i
ReDim byteArray(LenB(Binary))
For i = 1 To LenB(Binary)
byteArray(i-1) = AscB(MidB(Binary, i, 1))
concat2Bdy(AscB(MidB(Binary, i, 1)))
Next
BinaryToArray = byteArray
End Function
</script>
</head>
<body>
<input type="button" onclick="CreateEmail();" value="Attach Report" />
</body>
</html>
Thank you,
Mittal. -
Help needed in getting the previous Quarter Data
Hello folks,
I have this procedure where i have to modify the current procedure in the following manner:
I need to get rid of the variables p_start and p_end so that i cannot see them in the crystal report and include the Frequency in the procedure to get the Data based on the Dates.
and Main requirement is" If the Frequency is Quarterly " it should get the previous quarter Data, if "Frequency is monthly" it should return the previous month data.Can anyone please let me know where shud i make changes. Am including the procedure for refernce. Any help is appreciated
Thanks a millioin,
CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h(report_record in out cr_return_types.gen_cursor,
p_start string,
p_end string)
IS
v_startdate date;
v_enddate date;
BEGIN
v_startdate := to_date(p_start, 'YYYY/MM');
v_enddate := last_day(to_date(p_end, 'YYYY/MM'));
open report_record for
select --distinct r.recovery_id
r.event_id,
r.event_case_id,
c.client_id,
c.client_code,
c.client_name,
b.branch_group_code,
b.branch_group_description,
g.employer_group_code,
g.employer_group_name,
e.client_policy_identifier,
e.date_of_incident,
e.event_type_code,
sum(nvl(r.amount, 0)) as amt_received,
nvl(sum(case
when r.amount >= 0 then
rd.fees
else
rd.fees * (-1)
end),
0) as fees,
ec.close_date, *001* commented
(case
when ec.close_date <= to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
'MMDDRRRR HH24MISS') then
ec.close_date
else
null
end) as close_date, --*001* added
get_case_value(ec.event_id, ec.event_case_id, v_enddate) as case_value,
nvl(etl.fee_percent_flag, 'N') workmans_comp,
max(to_char(r.recovery_date, 'FMMonthYYYY')) Year_Month,
max(to_char(r.recovery_date, 'YYYYMM')) Y_M,
max(to_date(to_char(r.recovery_date, 'MMYYYY'), 'MM/YYYY')) date_MY
from recovery r,
recovery_detail rd,
event e,
client c,
branch_group b,
employer_group g,
event_case ec,
event_type_lookup etl
where r.event_id = e.event_id
and r.event_case_id = ec.event_case_id
and ec.event_id = e.event_id
and rd.recovery_id(+) = r.recovery_id
and r.recovery_date between v_startdate and
to_date(to_char(v_enddate, 'MMDDRRRR') || '235959',
'MMDDRRRR HH24MISS')
and e.client_id = c.client_id
and g.client_id = c.client_id
and b.client_id = c.client_id
and g.employer_group_id(+) = e.employer_group_id
and b.branch_group_id(+) = g.branch_group_id
and e.event_type_code = etl.event_type_code -- SST 130852 04/14/09
group by r.event_id,
r.event_case_id,
c.client_id,
c.client_code,
c.client_name,
b.branch_group_code,
b.branch_group_description,
g.employer_group_code,
g.employer_group_name,
e.client_policy_identifier,
e.date_of_incident,
e.event_type_code,
ec.close_date,
get_case_value(ec.event_id, ec.event_case_id, v_enddate),
nvl(etl.fee_percent_flag, 'N')
having sum(nvl(r.amount, 0)) <> 0
order by c.client_code,
b.branch_group_code,
g.employer_group_code,
r.event_case_id;
Edited by: user11961230 on Oct 20, 2009 9:02 AMuser11961230 wrote:
1. I want to get rid of the p_start and p_end. So how do i declare the v_startdate and v_enddate in the following part?
v_startdate := to_date(p_start, 'YYYY/MM');
v_enddate := last_day(to_date(p_end, 'YYYY/MM'));I'm not sure what you mean by "declare".
In PL/SQL, "declare" means state (at the beginning of a block) that there will be a certain variable with a certain name (such as v_startdate) and datatype (such as DATE). You're already declaring the variables v_startdate and v_enddate correctly, right before the BEGIN statement.
Declaring a variable is not the same as initializing it, that is, giving it a value for the first time. Your next question seems to be about initializing..
2. where exactly shud i include the logic that u have mentioned. sorry a dumb questionIn place of the two assignment statments that reference p_start and p_end.
3. This time am gonna use frequency instead of report_type so that i will get rid of the p_start and p_end from the procedure.Do you mean you want to pass an argument (called frequency) that tells if you want a quarterly or a mionthly report, just like the variable report_type in my example?
If so, replace report_type in my example with frequency.
I think you want something like this:
CREATE OR REPLACE PROCEDURE hcsc_recovery_report_h
( report_record in out cr_return_types.gen_cursor
, frequency IN VARCHAR2
IS
-- Declare local variables:
v_startdate date;
v_enddate date;
BEGIN
-- Initialize v_startdate and v_enddate, depending on frequency
IF frequency = 'QUARTERLY'
THEN
v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -3)
, 'Q'
v_enddate := TRUNC (SYSDATE, 'Q');
ELSIF frequency = 'MONTHLY'
THEN
v_startdate := TRUNC ( ADD_MONTHS (SYSDATE, -1)
, 'MM'
v_enddate := TRUNC (SYSDATE, 'MM');
END IF;
-- Subtract one second from v_enddate
v_enddate := v_enddate - ( 1
/ (24 * 60 * 60)
open report_record for
select --distinct r.recovery_id
r.event_id,
and r.recovery_date BETWEEN v_startdate
AND v_enddate
...When you post formatted text on this site (and code should always be formatted), type these 6 characters:
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
Edited by: Frank Kulash on Oct 20, 2009 2:37 PM
Changed query to use BETWEEN -
Error in using DBMS_LOB Package
Hi,
I am attaching a PDF File through a database procedure as shown below
create or replace procedure load_document(document_id in number, filename IN varchar2, doc_desc IN VARCHAR2, doc_type IN VARCHAR2) as
f_lob bfile;
b_lob blob;
--document_name varchar2(30);
--mime_type varchar2(30);
document_name oea_documents.document_name%TYPE;
mime_type oea_documents.document_mime_type%TYPE;
dot_pos number;
v_file_type VARCHAR2(10);
begin
-- Find the position of the dot ('.') located in the filename
dot_pos := instr(filename,'.');
-- Get the filename without extension and use it as image name
document_name := substr(filename,1,dot_pos-1);
-- Build the mime type . Retrieve the file extension and add it to 'image/'
v_file_type := SUBSTR( filename, dot_pos+1, Length(Filename) );
IF ( UPPER(v_file_type) IN ('JPG','JPEG','TIF','TIFF','GIF') ) THEN
mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
ELSIF ( UPPER(v_file_type) = 'PDF' ) THEN
mime_type := 'application/pdf';
ELSIF ( UPPER(v_file_type) = 'DOC' )THEN
mime_type := 'application/msword';
ELSIF ( UPPER( v_file_type) = 'XLS') THEN
mime_type := 'application/ms-excel';
ELSE
mime_type := 'image/'||substr( filename , dot_pos+1 , length(filename) );
END IF;
insert into oea_documents (document_id,
document_name,
document_mime_type,
document,
document_description,
document_type
values(document_id, document_name, mime_type, empty_blob(),doc_desc,doc_type) return document into b_lob;
-- /!\ Directory name has to be UpperCase !
f_lob := bfilename('FILE_LOAD',filename);
o_dset_test('5');
dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
o_dset_test('6');
dbms_lob.loadfromfile(b_lob,f_lob,dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
FILE_LOAD is a folder on the database server(unix).
I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.
while executing this procedure I am getting the error ora-22288(Invalid file or directory).
But this occurs randomly
For instance i tried to attach a pdf file with the name cross.pdf ,it gave me the above error and when i renamed the file as Cross.pdf it attached successfully.
The error comes whilke executing the statement dbms_lob.fileopen(f_lob,dbms_lob.file_readonly);
Please guide on the above issue.Hi,
Welcome to the forum!
user1356624 wrote:
f_lob := bfilename('FILE_LOAD',filename);
FILE_LOAD is a folder on the database server(unix).
I have also tried to give the full path on the unix databse server instead of FILE_LOAD directory but then it gives error ora-22285.The first argument to BFILENAME is the name of a directory object, as found in the directory_name column of all_directories. That is not the same thing as a folder name, which is found in the directory_path column of all_directories. Look up [CREATE DIRECTORY|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_5007.htm#sthref6211] in the SQL Language manual for a description of Oracle's directory objects.
If you have problems with this, post the results of
SELECT *
FROM all_directories;It might also be useful to see the Oracle "CREATE DIRECTORY" command that was used.
As you probably noticed, this site compresses white space by default.
When you post code or results on this site, type these 6 characters:
(small letters only, inside curly brackets) before and after sections of formatted text, to preserve spacing.
Edited by: Frank Kulash on Aug 10, 2009 3:35 PM
Added link. -
Displaying data in one row for for 2 tables without relaiton
I Have 2 tables without any relation and there is a common field and i want to display data like below
table refdet
1)
refdt----------refbr----refamt----refcat
10-aug-09---10-----34234-----101a
10-aug-009--11----23245-----102a
1-AUG-09----10----455.98----104A
19-aug-09-12-----10000-------103B
2) brdet
trdt---------brn-----brtot-----------brcat
11-aug09--10-----454000-------A
09-aug-09-12-----550000-------B
30-sep-09--10-----430000------A
09-aug-09-11-----550000-------B
i want to display data for each branch refdet.refbr = brdet.brn
refdet
Br10
refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
Br 11
10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
Br12
19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------B
i tried the following query but its not working
select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
from brdet a,refdet b
where a.refbr (+) = b.brn
union all
select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
from brdet a,refdet b
where a.refbr = b.brn (+)
its not giving the records on each row for both side its creating separte rows for each records in both table.
rgds
jytohi
-Hi jytohi,
Please lean back for a moment and study your question. Ask yourself, is this a reasonable way to ask a question?
Jopefully you'll reach the answer, "No it isn't, I need to.."
1. Turn these
1)
refdt----------refbr----refamt----refcat
2) brdet
trdt---------brn-----brtot-----------brcatinto CREATE TABLE statements.
2. Turn these
10-aug-09---10-----34234-----101a
10-aug-009--11----23245-----102a
1-AUG-09----10----455.98----104A
19-aug-09-12-----10000-------103B
11-aug09--10-----454000-------A
09-aug-09-12-----550000-------B
30-sep-09--10-----430000------A
09-aug-09-11-----550000-------Binto INSERT INTO statements
3. Turn this
refdet
Br10
refdt----------refbr----refamt----refcat-----trdt---------brn-----brtot-----------brcat
10-aug-09---10-----34234-----101a-------11-aug09--10-----454000-------A
1-AUG-09----10----455.98----104A------30-sep-09--10-----430000------A
Br 11
10-aug-009--11----23245-----102a -------09-aug-09-11-----550000-------B
Br12
19-aug-09-12-----10000-------103B------09-aug-09----12-----550000-------Binto properly formatted expected output, along with a reasonable explanation of why
4. Turn this
select distinct null as refdt,null as refbr,null as refamt,null as refcat,b.trdt,b.brn,b.brtot,b.brcat
from brdet a,refdet b
where a.refbr (+) = b.brn
union all
select distinct a.refdt,a.refbr,a.refamt,a.refcat,null as trdt,null as brn,null as brtot,null as brcat
from brdet a,refdet b
where a.refbr = b.brn (+)into a properly formatted query
And last, put everything in into curly brackets {noformat}{noformat} to preserve formatting and blank space.
Best regards
Peter -
Depicting multiple rows' data in one row
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkeybut if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 Zlotkeypls. help me to sort out the above sought o/p.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p in easily readable format, but couldn't do that.
Edited by: Shariful on Sep 20, 2009 4:28 AM
Edited by: Shariful on Sep 20, 2009 4:29 AMHi,
Shariful wrote:
Hi All,
Pls. check the below query:
select manager_id mg_id, employee_id emp_id, last_name name from employees
where manager_id = '100'
and DEPARTMENT_ID = '80'
if i run the following query, then o/p comes row wise; like below:
mg_id emp_id name
100 145 Russell
100 146 Partners
100 147 Errazuriz
100 148 Cambrault
100 149 Zlotkey
but if i want the o/p like below; i.e; under manager # 100, all employees' emp_id and name should come in only ONE row NOT in multiple rows:
mg_id emp_id name emp_id name emp_id name emp_id name emp_id name
100 145 Russell 146 Partners 147 Errazuriz 148 Cambrault 149 ZlotkeyIf you want all the emp_ids and names concatenated into one big VARCHAR2 column, that's called String Aggregation
[AskTom.oracle.com|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2196162600402] shows several different ways to do it.
You can format that one big column so that it looks like separate columns.
If you want each emp_id and name in its own column, that's called Pivoting .
Look up "pivot" for various techniques. If you do not know exactly how many rows were in the original query (and therefore how many columns you'll need in the output), then it will require Dynamic SQL , which can be complicated.
Unfortunately, when you do search for "pivot", mlost of the hits will be things like "Search for pivot and you'll get lots of examples".
Re: Help for a query to add columns is one that actually has some information. It was a question very much like yours.
kindly tell me if there is any posting guidelines (except "Plain Text Help" on the right side) in this forum. i tried a lot to post above two o/p and query in easily readable format, but couldn't do that.Type these 6 characters:
(small letters only, inside curly brackets) before and after formatted text, to preserve spacing. -
What is wrong with this code? on(release) gotoAndPlay("2")'{'
Please could someone tell me what is wrong with this code - on(release)
gotoAndPlay("2")'{'
this is the error that comes up and i have tried changing it but it is not working
**Error** Scene=Scene 1, layer=Layer 2, frame=1:Line 2: '{' expected
gotoAndPlay("2")'{'
Total ActionScript Errors: 1 Reported Errors: 1
ThanksIf you have a frame labelled "2" then it should be:
on (release) {
this._parent.gotoAndPlay("2");
or other wise just the following to go to frame 2:
on (release) {
this._parent.gotoAndPlay(2);
You just had a missing curly bracket...
Maybe you are looking for
-
ITunes 6.0.2 Problems
Now apple has finally given you the option of being able to make a video either a (1)movie, (2)music video, and now (3)TV Show with iTunes 6.0.2. I've been waiting for this for a while now and they finally did it! I have been having to put my shows i
-
After upgrading to io6 my battery runs out daily.
After upgrade my battery doesn't even last a full day!!! Took it off the charger at 7.30 this morning, now 1pm and it has died again! Why no option to revert back to previous? Also, had no Apps running all day, sent two messages this morning and rema
-
Problem in executing TCode IFCU
Hi Experts, i am facing a problem in TCode IFCU, i've done all required customization for the same,after entering a value on IFCU screen, when i give save option, system flashed below mwntioned mesaage, please suggest the solution, Unit of measure L
-
Detecting Changes In Clipboard Data?
Hi, is it possible to detect when data on the clipboard has changed in Java? I am looking to generate an event or similar when something is copied. Thanks
-
Hi All, Is their any way to process the Idoc in queue by using IDOC_INBOUND_ASYNCHRONOUS. Right now, it is processing by IDOC_INBOUND_IN_QUEUE. Thanks John.