Issue in setting unique ID in Domino designer - unique

I am new to Domino designer and lotus script,
following my second question,
I have some issue in setting unique ID (for id field in form).
My formula for Id field value :
T_List:=#DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1);
#If(#IsNewDoc & #Elements(T_List)=0;1;#IsNewDoc & !#IsError(T_List);#Subset(T_List;1) + 1;id)
I'm having DB in local (nothing shared).
referred this link an Answer by AndrewB
Server : Local
DBname : DBintro
view name : testview
id - field in the form (which is set when required to save in DB)
Error I'm getting
Field id ! does not exist
Please help me to get out of this..
Thanks
EDIT :1 Updated code
T_List:=#DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1);
T_List:=#Sort(T_List; [DESCENDING]);
#if(#Iserror(T_List);
1;
#Subset(T_List;1)+1
);

Set type of field "testid" to "Number"
Change formula to
_List:=#DbColumn("" : "NoCache"; ""; "testview"; 1);
#If( #IsError(_List);
1;
_List = "";
1;
#Subset(_List; 1) + 1
)
Set column sort to "Descending"

Perhaps re-arranging the logic might help - try this in the formula for Id field. Make the field "Computed When Composed" (next to field typer in properties box - it means it only evaluates when the doc is first created, and remains the same after - saves detecting #IsNewDoc :-D ):
T_List:=#DbColumn("" : "NoCache"; "Local"; "DBintro";"testview"; 1);
#if(#Iserror(T_List);
1;
#Subset(T_List;1)
);
You don't have to worry about the id field returning itself if the doc isn't new, because the computed when composed field stops evaluating after 1st save.

Bad formula for your dbColumn. There should be a colon, not semi-colon between servername and filename. Of course, there is no server named "Local". You would just use "" for local. Also, the filename is the full filename - "DBintro.nsf", not "DBintro".
T_List:=#DbColumn("Notes":"NoCache"; "":"DBintro.nsf";"testview"; 1);
T_List:=#Sort(T_List; [DESCENDING]);
#if(#Iserror(T_List);
1;
#Subset(T_List;1)+1
);

Have you got the unique ID set as a text field because I have found that the formula has to be converted to a text value and not just the unique document id.

Related

How to check in sikuli that image is exist in screen or not and perform if else condition on that result

I am trying to automate a desktop application in sikuli. What i am doing copying data from from existing user and creating new user using some of that data. In form there are two check boxes. If that check boxes is ticked for existing user, then while creating new user i need to check the text box. for that am taking checked text box image and giving in if condition. If checked text box image is there in that page i will carry value 1 to a variable else value will be 0. according to that value am performing check uncheck function in new user creation page. But the issue what i am facing is, am not able to check if the image exist in that page or not in sikuli. Please anybody help me. my code is giving below
int bomanager=0;
int boswitchboard=0;
System.out.println("boswitchboard value before assign it to 1" + bomanager);
if (screen.exists("images/backofficeswitchboardwithtick.png") != null)
{
boswitchboard=1;
System.out.println("boswitchboard value after assign"+boswitchboard);
}
System.out.println("bomanager value before assign it to 1" + bomanager);
if(screen.exists("images/backofficemanagerwithtick.png") != null)
{
bomanager=1;
System.out.println("bomanager value after assign it to 1"+bomanager);
}
then using this value need to perform below function.
System.out.println("Before condition" + bomanager);
if (bomanager ==0){
screen.click("images/backofficemanagerwithtick.png");
}
screen.setAutoWaitTimeout(10);
System.out.println("Before condition" + boswitchboard);
if(boswitchboard==0){
System.out.println("Inside To tick Condition" + boswitchboard);
System.out.println("Ticking the SwitchBorad when itsnot already ticked");
screen.click("images/backofficeswitchboardwithtick.png");
}
I'm asssuming you're looking to use "if exists" method here
if exists(img, timeout):
click(img)
else:
....
with the method exists() I usually use:
if(exists("yourUrlImage")!=null):
(do something when exists)
else:
(do another thing when not exists)
Because that will return a "match" object.
Hope this helps

Value Calculation issue in Google web HTML App

I have created an HTML web app in google script this works like a calculator, This app works fine if I add the input in descending order however if I skip the order and update in put data numbers randomly in any column then I am not getting the output properly
Example:- update the numbers in box number 4 and 5 then update in box number 1 you will find the differences in total numbers
Please refer the attached sheet for detailed script
Project Name- Project Proposal Form
$("#rTpe1").keyup(function(e){
$("#rFor1").val(this.value * $("#PerHourRate1").val());
$("#rFor3").val( Number($("#rFor1").val()) +Number($("#rFor2").val()))
});
$("#rTpe2").keyup(function(e){
$("#rFor2").val(this.value * $("#PerHourRate2").val());
$("#rFor3").val( Number($("#rFor1").val()) + Number($("#rFor2").val()))
});
$("#rTpe12").keyup(function(e){
$("#rFor12").val(this.value * $("#PerHourRate3").val());
$("#rFor3").val( Number($("#rFor1").val()) + Number($("#rFor2").val())+ Number($("#rFor12").val()))
});
$("#rTpe13").keyup(function(e){
$("#rFor13").val(this.value * $("#PerHourRate4").val());
$("#rFor3").val( Number($("#rFor1").val()) + Number($("#rFor2").val())+ Number($("#rFor12").val())+ Number($("#rFor13").val()))
});
I could be wrong, but I think that's the main culprit:
If your work your way top to bottom, the output in '#rFor3' is not affected. For example, if you enter values in the first field ('#rTpe1'), this statement
Number($("#rFor2").val()))
will evaluate to '0' because '#rFor2' probably contains an empty string at this point and Number("") will get you a zero. Because all subsequent input fields reference the results of previous calculations ('rTpe2' references 'rFor1', 'rTpe12' references both 'rFor1' and 'rFor2', etc), the sum will come out as correct.
Now consider the reverse scenario. For simplicity, let's make all your rates equal to 1. If you enter the value of '5' into 'rTpe12', the value of 'rFor3' will be
Number("") + Number("") + Number(5*1) == 5; //the first two inputs will contain empty strings at this point
The output of '#rFor3' would be 5. If you go up a step and enter the value of '2' into 'rTpe2', the value of the 'rFor3' output will change to
Number("") + Number(2*1) == 2; the first input will contain an empty string.
The code is not easy to understand, so even if this solution doesn't work for you, consider caching your DOM elements to improve performance and make your code more readable. Currently, you are using jQuery selectors to search the DOM over and over again, which is a serious performance drag. You could also store your calculated value as a variable and simply add values to it instead of recalculating on each input. For example
$('document').ready(function(){
var total = 0;
var input1 = $('#input1');
var input2 = $('#input1');
var input3 = $('#input1');
var output = $('#output');
input1.keyup(function(e){
var value = Number(this.value);
sum += value;
output.val(sum);
});
});

Update planned order - two committed modifications, only one saved

I need to update two information on one object: the quantity (PLAF-gsmng) and refresh the planned order via the module function 'MD_SET_ACTION_PLAF'.
I successfully find a way to update each data separately. But when I execute the both solutions the second modification is not saved on the database.
Do you know how I can change the quantity & set the action on PLAF (Planned order) table ?
Do you know other module function to update only the quantity ?
Maybe a parameter missing ?
It's like if the second object is locked (sm12 empty, no sy-subrc = locked) ... and the modification is not committed.
I tried to:
change the order of the algorithm (refresh and after, change PLAF)
add, remove, move the COMMIT WORK & COMMIT WORK AND WAIT
add DEQUEUE_ALL or DEQUEUE_EMPLAFE
This is the current code:
1) Read the data
lv_plannedorder = '00000000001'
"Read PLAF data
SELECT SINGLE * FROM PLAF INTO ls_plaf WHERE plnum = lv_plannedorder.
2) Update Quantity data
" Standard configuration for FM MD_PLANNED_ORDER_CHANGE
CLEAR ls_610.
ls_610-nodia = 'X'. " No dialog display
ls_610-bapco = space. " BAPI type. Do not use mode 2 -> Action PLAF-MDACC will be autmatically set up to APCH by the FM
ls_610-bapix = 'X'. " Run BAPI
ls_610-unlox = 'X'. " Update PLAF
" Customize values
MOVE p_gsmng TO ls_plaf-gsmng. " Change quantity value
MOVE sy-datlo TO ls_plaf-mdacd. " Change by/datetime, because ls_610-bapco <> 2.
MOVE sy-uzeit TO ls_plaf-mdact.
CALL FUNCTION 'MD_PLANNED_ORDER_CHANGE'
EXPORTING
ecm61o = ls_610
eplaf = ls_plaf
EXCEPTIONS
locked = 1
locking_error = 2
OTHERS = 3.
" Already committed on the module function
" sy-subrc = 0
If I go on the PLAF table, I can see that the quantity is edited. It's working :)
3) Refresh BOM & change Action (MDACC) and others fields
CLEAR ls_imdcd.
ls_imdcd-pafxl = 'X'.
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = lv_plannedorder
iaccto = 'BOME'
iaenkz = 'X'
imdcd = ls_imdcd
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3
OTHERS = 4.
IF sy-subrc = 0.
COMMIT WORK.
ENDIF.
If I go on the table, no modification (only the modif. of the part 2. can be found on it).
Any idea ?
Maybe because the ls_610-bapco = space ?
It should be possible to update planned order quantity with MD_SET_ACTION_PLAF too, at least SAP Help tells us so. Why don't you use it like that?
Its call for changing the quantity should possibly look like this:
DATA: lt_acct LIKE TABLE OF MDACCTO,
ls_acct LIKE LINE OF lt_acct.
ls_acct-accto = 'BOME'.
APPEND lt_acct.
ls_acct-accto = 'CPOD'.
APPEND lt_acct.
is_mdcd-GSMNG = 'value' "updated quantity value
CALL FUNCTION 'MD_SET_ACTION_PLAF'
EXPORTING
iplnum = iv_plnum
iaenkz = 'X'
IVBKZ = 'X'
imdcd = is_mdcd "filled with your BOME-related data + new quantity
TABLES
TMDACCTO = lt_accto
EXCEPTIONS
illegal_interface = 1
system_failure = 2
error_message = 3.
So there is no more need for separate call of MD_PLANNED_ORDER_CHANGE anymore and no more problems with update.
I used word possibly because I didn't find any example of this FM call in the Web (and SAP docu is quite ambiguous), so I propose this solution just as is, without verification.
P.S. Possible actions are listed in T46AS table, and possible impact of imdcd fields on order can be checked in MDAC transaction. It is somewhat GUI equivalent of this FM for single order.

How to fetch a record from a column or field?

I have a table with a column named balance.
if(mysqli_num_rows($get_bank_check_res) > 0){
$display_block = "<p>your autho code is:</p>";
$account_check = mysql_fetch_array($get_bank_check_res);
$balance= $account_check > $grand_total_safe ? (balance - $grand_total_safe) : 0;
$display_block .= "<p>your balance is: '".$balance."' </p>";
I received the warning : Undefined variable balance. Trying mysql_fetch_assoc() didn't work either.
You get a row back with mysql_fetch_array, it doesn't automagically create new variables for you. Ie your column is located here. Also, since you are using the MySQLi extension instead of mysql, it look like this:
$row = $get_bank_check_res->fetch_assoc();
$balance = $row["balance"];
then you can do you whatever math your doing using the values found inside your $row array.

Select statement selection through URL parameters

I'm attempting to alter the contents of certain parts of a HTML form through usage of the URL. For a text field, I'm aware that this will suffice,
http://<domain>?fieldname=ping&anotherfield=pong
On the form there are multiple select braces (drop down boxes); Is it possible to pick an int or string value through the url for this?
There seems to be little documentation on this (or even people trying to do the same)...
You haven't specified how you want to do this, but I'll assume that you want to use JavaScript:
To get a value from QueryString:
getQueryStringArgument = function(key) {
var hu = window.location.search.substring(1);
var gy = hu.split("&");
for (i = 0; i < gy.length; i++) {
var ft = gy[i].split("=");
if (ft[0] == key)
return ft[1];
}
}
To set the selected value of the select list:
document.getElementById("sel").value = getQueryStringArgument("id");
For a text field, I'm aware that this will suffice
No, it won't (at least, not in a generic way).
For a text field, the default value is specified by the value attribute. There might be a server side script that populates it based on query string data, but there doesn't have to be.
On the form there are multiple select braces (drop down boxes); Is it possible to pick an int or string value through the url for this?
Again, this requires an attribute to be set (selected on <option>), and that could (again) be set by a server side script based on the query string data.