The following line of code works:
=COUNTIFS('1ST SY: 2021-2022'!$K:$K,A23,'1ST SY: 2021-2022'!$L:$L,"*1/2/2023*") + COUNTIFS('2ND SY: 2021-2022'!$K:$K,A23,'2ND SY: 2021-2022'!$L:$L,"*1/2/2023*") + COUNTIFS('1ST SY: 2022-2023'!$K:$K,A23,'1ST SY: 2022-2023'!$L:$L,"*1/2/2023*")
The problem is I'm trying to replace the date part:
"*1/2/2023*" into something like (B2 + "*") but it doesn't seem to work. Take note that B2 Stands for a date cell.
I have tried replacing it with:
TEXT(B2, "mm/dd/yyyy") + "*"
But again, still not working. Can anyone tell me how do I achieve this?
Related
My Question : How to Remove a value and replace a new value
My Field value inside InvGSTSummary :
Value 1:
"- 0%,19291.76,0.00"
"SE 0%,1068.39,0.00"
"ST 6%,2000.00,120.00"
The order of the Text List might change everytime,
Value 2:
"SE 0%,1068.39,0.00"
"- 0%,19291.76,0.00"
"ST 6%,2000.00,120.00"
Sample formula i write for testing as below :
InvGSTSumCode = #Word(InvGSTSummary; ","; 1)
The question is May i know how to take the First 2 character is "SE" to
amend the last 3 value become by (using 1068.39 * 6%=64.1034), than
replace the last 3 value become 64.1034
Final Result For the value should be :
"- 0%,19291.76,0.00"
"SE 0%,1068.39,64.10"
"ST 6%,2000.00,120.00"
New Update item: on 08/07/2019
Sorry may be my question not clear. Actually what i want to ask is possible to Loop over the a "field" [text list] for condition (if found "SE") value than just redo other calculation on the page.
New Update item: on 10/07/2019
Formula to extract the orignal value and replace value
FullSummary := #Trim(#Replace("SE" + #Right(InvGSTSummary; "SE"); "SE"; ""));
STCode := #Word(FullSummary; ","; 1);
Price := #Word(FullSummary; ","; 2);
SST:=#TextToNumber(Price) * 0.06;
CompVal:= STCode +","+Price+","+#Text(SST; "F2");
CompVal
Result of the formula:
Get field's entry you want to change,
Calculate entry's new value,
Replace entry in field.
Example for replacing entry that starts with "SE":
_entryOld := #Trim(#Replace("SE" + #Right(InvGSTSummary; "SE"); "SE"; ""));
_entryNew := #Word(_entryOld; ","; 1) + ... calculate your new value based on _entryOld;
#Replace(InvGSTSummary; _entryOld, _entryNew);
Here is an alternative for the "loop" to get the entry with "SE":
_entryOld := #Trim(#Transform(InvGSTSummary; "entry";
#If(#Contains(entry; "SE"); entry; "")));
Update to your updated question:
Use #Replace in last code line to replace the old entry (FullSummary) with the new value (CompVal):
FullSummary := #Trim(#Replace("SE" + #Right(InvGSTSummary; "SE"); "SE"; ""));
STCode := #Word(FullSummary; ","; 1);
Price := #Word(FullSummary; ","; 2);
SST:=#TextToNumber(Price) * 0.06;
CompVal:= STCode +","+Price+","+#Text(SST; "F2");
#Replace(InvGSTSummary; FullSummary, CompVal);
I am using gembox.spreadsheet to import data in rich text box, here's the code :
Private Sub OpenFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim ef As ExcelFile = ExcelFile.Load(OpenFileDialog1.FileName)
Dim sb As New StringBuilder()
For Each sheet As ExcelWorksheet In ef.Worksheets
sb.AppendLine()
sb.AppendFormat("{0} {1} {0}", New String("-"c, 25), sheet.Name)
For Each row As ExcelRow In sheet.Rows
sb.AppendLine()
For Each cell As ExcelCell In row.AllocatedCells
If cell.ValueType <> CellValueType.Null Then
sb.Append(String.Format("{0} [{1}]", cell.Value, cell.ValueType).PadRight(25))
Else
sb.Append(New String(" "c, 25))
End If
Next
Next
Next
bodytxt.Text = sb.ToString()
End Sub
The problem is , when the .xls file is imported/loaded in the bodytxt textbox, it looks very weird...Something like :
------------------------- Sheet1 -------------------------
[String] Pic [String] Unique id [String]
Prefix [String] First name [String] Last name [String]
Gender [String] Title [String] Company [String]
Phone [String] Mobile [String] Fax [String]
B.Email [String] P.Email [String] Reference [String]
Address [String] Address 2 [String] Country [String]
City [String] Zip [String] Facebook [String]
Is there any way to display the data like excel displays the data/show the data in a table/or at least arrange the data's properly one after one because it looks very messy(i arranged them in the post differently so that they would show in a code block).Any way to do so ?
UPDATE 1
I figured something out..And this may help every one who are looking for a way to create a table in rich textbox. Let me explain a few things first.Inserting a table in rich textbox is quiet impossible (as far as I think) or at least creating a cutomizable table in rtxtbox like MS WORD is quiet impossible/difficult.... But what if we can find another way to do so? Let us think for a while.... A DATA GRID VIEW CAN LOAD DATA FROM EXCEL, right? NOW HOW ABOUT LOADING THE DATA IN A DATAGRIDVIEW AND THEN ADDING THE ROWS' CELL VALUES IN THE RICH TEXT BOX ..AND AFTER EVERY ROW , WHY NOT ADD A BUNCH OF "---"(dashes)? THEN EVERY ROW WOULD LOOK SEPARATE AND WOULD GIVE US A TABLE-ish LOOK....! The code for both C++ and VB.net are given below :
C++
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms
'populate your dgvw first
'Create a button to add data from dgvw to rtxtbox
private void button1_Click(object sender, EventArgs e)
{
for(int i = 0; i < dataGridView1.Rows.Count - 1; i++)
{
richTextBox1.Text = richTextBox1.Text + "-";
for(int j = 0; j < dataGridView1.Columns.Count; j++)
{
richTextBox1.Text = richTextBox1.Text + "\t" + dataGridView1.Rows[i].Cells[j].Value.ToString() + "\t";
}
richTextBox1.Text = richTextBox1.Text + "\n";
richTextBox1.Text = richTextBox1.Text + "----------------------------------------------------------------------------------------------------------"; 'the dashes vary on the cell width/cell number so add as many dashes as u need
richTextBox1.Text = richTextBox1.Text + "\n";
}
}
}
}
VB.NET
'use the same namespaces as c++(if required)
'populate dgvw
'add a button to transfer data from dgvw to richtxtbx
Public sub Button1_click
For i As Integer = 0 To dgvw1.Rows.Count - 2
RichTextBox1.Text = RichTextBox1.Text + "-"
For j As Integer = 0 To dgvw1.Columns.Count - 1
Try
RichTextBox1.Text = RichTextBox1.Text + vbTab + dgvw1.Rows(i).Cells(j).Value.ToString() + vbTab
Catch ex as exception
End try ' The try statement is used so that OBJECT REFERENCE NOT SET TO AN INSTANCE OF OBJECT error can be prevented as it happens when a cell value is null
RichTextBox1.Text = RichTextBox1.Text + vbLf
RichTextBox1.Text = RichTextBox1.Text + "----------------------------------------------------------------------------------------------------------"
RichTextBox1.Text = RichTextBox1.Text + vbLf
Next
Next
End Sub
This may not be the perfect solution but this will get the job done and you can make any changes you want.... THIS IS WHAT I GOT SO FAR AND I WILL UPDATE AS SOON AS I FIND SOMETHING NEW
It may not be an answer to your question but as far as i think,if any of your cell value is null then youl'ld get a "Object reference not set to an instance of object" error in
RichTextBox1.Text = RichTextBox1.Text + vbTab + dgvw1.Rows(i).Cells(j).Value.ToString() + vbTab
So i suggest you using a TRY STATEMENT here...
I have tried several times to enter a date range into the Search in view.
The search string i put into Search in view is as follow.
compositeData.Operasjon = "ST-MOD"
" FIELD OprPlanGruppe_1 = " + compositeData.Operasjon + " AND FIELD OprDato_1 = " +
dates.substring(0, dates.length() - 1);
The result is that only the last key value pair (FIELD OprDato_1 = 11.02.2014) is used to filter
The hole code is below:
var idag:java.util.Date = new java.util.Date();
var cal:java.util.Calendar =java.util.Calendar.getInstance();
var dateFormat:java.text.SimpleDateFormat = new java.text.SimpleDateFormat("dd.MM.yyyy");
cal.set(java.util.Calendar.HOUR_OF_DAY, 0); // ! clear would not reset the hour of day !
cal.clear(java.util.Calendar.MINUTE);
cal.clear(java.util.Calendar.SECOND);
cal.clear(java.util.Calendar.MILLISECOND);
var dates = "";
var i;
for(i = 0; i < 7; i++){
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek() + i);
dates += dateFormat.format(cal.getTime()) + ",";
}
dates = dates.replace("undefined", "");
return " field OprPlanGruppe_1 = " + compositeData.Operasjon + " AND FIELD OprDato_1 = " + dates.substring(0, dates.length() - 1);
Is there any possibilities to add more than one value after Field in the filter query?
Ex: FIELD OprDato1 = 10.02.2014,11.02.2014
You want to show all documents in view which have in field "OprDato_1" a date that is within the current week. You use the "Search in view results" property of xp:viewPanel. It uses full text search and has to have the syntax of full text search. You can compare dates with ">=" and "<=". So, an easy way to look for dates in a certain date range is
FIELD OprDato_1 >= 10.02.2014 AND FIELD OprDato_1 <= 16.02.2014
or shorter as
[OprDato_1] >= 10.02.2014 AND [OprDato_1] <= 16.02.2014
Your code for calculating the search string would look like this:
var cal:java.util.Calendar =java.util.Calendar.getInstance();
var dateFormat:java.text.SimpleDateFormat = new java.text.SimpleDateFormat("dd.MM.yyyy");
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
var firstDate = dateFormat.format(cal.getTime());
cal.set(java.util.Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek() + 6);
var lastDate = dateFormat.format(cal.getTime());
return "FIELD OprPlanGruppe_1 = " + compositeData.Operasjon +
" AND FIELD OprDato_1 >= " + firstDate +
" AND FIELD OprDato_1 <= " + lastDate
This code calculates the date range for current week. You are free to set cal to any other date and date range would then be the week of this date.
My professor is teaching us Scala using Horstmann's book "Scala for the impatient", and one of our homework exercises are straight from the book; Chapter 4, exercise 2.
We are expected to read in the eBook in text format, the professor has specified that the input file should be "Moby Dick", available for free from the Guttenberg project here: http://www.gutenberg.org/ebooks/2701.txt.utf-8
My code works, as far as counting instances of words. However, he has added the requirement that we must we must format the output in two two columns, with words left justified, and counts right justified. To do so, I am determining the longest word in the book so I can figure the width of the "word" column. However, the values I am getting for the length of the strings is just wrong. In fact, it tells me that all the strings are the same length. "a" is being reported as length 26, just as is "Whale", "Ishmael", etc...
Here's the code:
object Chapter4Exercise2 extends App {
//for sorting
import util.Sorting._
//grab the file
val inputFile = new java.util.Scanner(new java.io.File("moby.txt"))
//create a mutable map where key/values == word/count
val wordMap = collection.mutable.Map[String, Int]() withDefault (_ => 0)
//for formatting output (later), the longest word length is relevant
var longestWord = 0
var theWord: String = ""
//start reading each word in the input file
while (inputFile hasNext) {
//grab the next word for processing, convert it to lower case, trim spaces and punctuation
var nextWord = inputFile.next().toLowerCase().trim().filter(Character.isLetter(_))
//if it's the longest word, update both theWord and longestWord
if (nextWord.size > longestWord) longestWord = nextWord.size; theWord = nextWord; println(theWord + " " + longestWord)
//update the map value for the key with same value as nextWord
wordMap(nextWord) += 1
}
println("Longest word is " + theWord + " at " + longestWord + " Characters")
}
The output of these lines:
if (nextWord.size > longestWord) longestWord = nextWord.size; theWord = nextWord; println(theWord + " " + longestWord)
and
println("Longest word is " + theWord + " at " + longestWord + " Characters")
is way off. It's telling me that EVERY word in the input file is 26 characters long!
Here's a small sample of what's being output:
husks 26
on 26
a 26
surfbeaten 26
beach 26
and 26
then 26
diving 26
down 26
into 26
What am I missing/doing wrong?
if (nextWord.size > longestWord) longestWord = nextWord.size; theWord = nextWord; println(theWord + " " + longestWord)
You shouldn't write multiple statements on a single line like that. Let's write this out in multiple lines and properly indent it:
if (nextWord.size > longestWord)
longestWord = nextWord.size
theWord = nextWord
println(theWord + " " + longestWord)
Do you see the problem now?
Try putting { and } around your if statement alternatives.
You can avoid this kind of pitfall by formatting your code in a structured manner - always using braces around code blocks.
if (nextWord.size > longestWord)
{
longestWord = nextWord.size;
theWord = nextWord;
println(theWord + " " + longestWord);
}
Your current code is equivalent to
if (nextWord.size > longestWord)
{
longestWord = nextWord.size;
}
theWord = nextWord;
println(theWord + " " + longestWord);
I have a question regarding SharePoint permission masks. In SharePoint it is possible to set the grant/deny rights using masks. Details are given the following article.
http://msdn.microsoft.com/en-us/library/dd304243(PROT.13).aspx
My question is when we have a permission/deny mask.
For example if you deny “ViewItem” permission using the central-admin, you will get 4611686844973976575 as the deny mask. This permission masks is computed by aping | to several individual permission masks.
So is it possible to extract individual permission masks which are used to calculate permission mask such as 4611686844973976575?
Thanks.
If you do a logical AND operation on a value such as 0x0000000000000001 for "ViewListItems" which is contained in the mask, then you will get the value itself (or 1). If you do a logical AND on a value not in that mask, like the "UseClientIntegration" value of 0x0000001000000000, then you will get a zero (0). This is something you can even test via the scientific mode of the Windows calculator app -- perhaps first converting the mask to hex, such as taking your example of 4611686844973976575 from base 10 to 400000C072040BFF in hex (base 16).
To extract all values from the mask, you would have to test the initial value against all possible values. If all known permission values are documented on that page, then the answer to your question is yes. I don't know which language you may want to accomplish this, but the basic idea in C# is:
bool CheckMask( long Mask, long TestPermission ) {
return (Mask && TestPermission) > 0;
}
long mask = 4611686844973976575;
const long ViewListItems = 0x0000000000000001;
bool HasPermission_ViewListItems = CheckMask(mask, ViewListItems);
// HasPermission_ViewListItems is true
const long UseClientIntegration = 0x0000001000000000;
bool HasPermission_UseClientIntegration = CheckMask(mask, UseClientIntegration);
// HasPermission_UseClientIntegration is false
I made this javascript sample thanks to #zanlok answer
I used JQuery, SPServices js (http://spservices.codeplex.com/)
and this link for the masks codes
http://msdn.microsoft.com/en-us/library/dd304243%28PROT.13%29.aspx
I Hope this helps you, I did this because I was needing it also, however it may also help others.
You need to replace the divid with the value of the control you want to place the html, and the LIST NAME HERE with the name of the list.
The script will spit everyone that has access to a list, and say if they can read, add, change and delete things. Hopes this helps you.
$('#divid').html('Working...').SPServices({
operation: "GetPermissionCollection",
objectName: 'LIST NAME HERE',
objectType: "List",
completefunc: function (xData, Status) {
var out = "<ul>";
$(xData.responseXML).find("Permission").each(function () {
if ($(this).attr("MemberIsUser") === "True") {
out += "<li>User: " + $(this).attr("UserLogin") + "</li>";
} else {
out += "<li>Group: " + $(this).attr("GroupName") + "</li>";
}
var readmask = 0x0000000000000001;
var addmask = 0x0000000000000002;
var editmask = 0x0000000000000004;
var deletemask = 0x0000000000000008;
out += "<li>Mask: " + $(this).attr("Mask") + "</li>";
var canread = readmask & $(this).attr("Mask").toString(16) > 0 ? "Yes" : "No";
var canadd = addmask & $(this).attr("Mask").toString(16) > 0 ? "Yes" : "No";
var canedit = editmask & $(this).attr("Mask").toString(16) > 0 ? "Yes" : "No";
var candelete = deletemask & $(this).attr("Mask").toString(16) > 0 ? "Yes" : "No";
out += "<li>Can Read: " + canread + "</li>";
out += "<li>Can Add: " + canadd + "</li>";
out += "<li>Can Edit: " + canedit + "</li>";
out += "<li>Can Delete: " + candelete + "</li>";
});
out += "</ul>";
$('divid').html(out);
}
});