Andreas Pfeiffer
Forum Replies Created
-
Hi Martin,
Yes – this is possible within Omnis.
Check out the pictconv… functions. Here is a link to the documentation: https://www.omnis.net/developers/resources/onlinedocs/FunctionRef/Functions_A-Z/pictconvfrom.html#pictconvfrom
There is also a function to find out what format the picture is: https://www.omnis.net/developers/resources/onlinedocs/FunctionRef/Functions_A-Z/pictformat.html#pictformat
Hope this helps.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorFebruary 3, 2025 at 8:10 am in reply to: Secure Logon to Omnis Web AppAwesome Uwe, well done!
We love to see our customers happy!
Best regards,
Andreas
-
Andreas Pfeiffer
AdministratorJanuary 20, 2025 at 2:13 pm in reply to: passing param into loading overlayMartin,
Do not use a server side timer.
Instead use the timer control and run the timer on the client side.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorJanuary 9, 2025 at 2:04 pm in reply to: Secure Logon to Omnis Web AppHi Uwe,
You might want to check out the JS Preferences sample library in the HUB. It allows to store a secret key in the local storage of the browser.
However doesn’t the browser support to store the credentials? It should work automatically to load the credentials from the password manager when visiting the site.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 30, 2024 at 9:33 am in reply to: Merging list losing smart propertiesMartin,
I think it is because you are joining the list. That might destroy the $smartlist. I wonder why you are not simply using the import list instead?
Alternatively you could use a $sendall instead:
Do iDataList.$clear()
Do iDataList.$smartlist.$assign(kTrue)
Do iImportList.$sendall(iDataList.$add().$assignrow($sendallref))
Do iDataList.$dowork()
But – it is confusing for me that you are actually calling this method from the popup form – but you are not passing the list as a parameter from the popup form into the method that suppose to store this. Why not saving the data directly within the popup form instead calling a method in the main form?
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 15, 2024 at 3:55 pm in reply to: Dialogform container messagingMartin,
after thinking about that issue when you pass in a parameter from the UI which of the columns need to be checked – it is still not OO. The task to control the business rules – in that case which columns are unique should be encapsulated in the list not in the remote form instance.
But this is easy to achieve. Each inherited table class that uses a schema class and therefore the method in the super table class can also access any of the column properties of the attached schema class.
So what you can do is to set a marker in the columns in question in the schema class. I used a “{u}” – so open curly brackets, u (unique) and close curly brackets.
Here is the change in $showduplicates
Set reference lSchemaRef to $schemas.[$cinst.$sqlclassname] ## this is the schema class that is attached to the concrete table class - remember this code would normally be in your super table class
If lSchemaRef
Do lSchemaRef.$objs.$sendall($cinst.$hidenonduplicates($ref.$name),contains($ref.$desc,'{u}'))
Calculate lHasDuplicates as $cinst.$linecount>0
Else
Send to trace log 'instance does not have a schema when running $showduplicates'
End If
So instead of using a parameter we now use the description property of the columns in the attached schema class.
And we assume that the code that we have written will be in the super table class and hence it will work on all inherited table classes.
From now on you do not even need to remember this when you design the UI part.
I hope this makes sense. Library attached.
Best,
Andreas
-
This reply was modified 1 year ago by
Andreas Pfeiffer.
-
This reply was modified 1 year ago by
-
Andreas Pfeiffer
AdministratorFebruary 12, 2025 at 10:46 am in reply to: Omnis goes PlantUml with C4 Plugin, but how do I write the content to a fileGreat! It will good to see you again!
Best,
Andreas
-
Andreas Pfeiffer
AdministratorFebruary 10, 2025 at 9:45 am in reply to: Omnis goes PlantUml with C4 Plugin, but how do I write the content to a fileHello Rainer,
You are welcome. I am glad you found my technical note.
Also there is a sample library in the HUB that shows how to import or export when using a remote form: jsFileUploadDownload
Best,
Andreas
-
Andreas Pfeiffer
AdministratorJanuary 28, 2025 at 8:21 am in reply to: Secure Logon to Omnis Web AppHi Uwe,
I did a quick test with the sample library from the HUB copying the following into the $init method of the remote form:
Do lPrefRow.$define(lPrefName,lPrefValue)
Do lPrefRow.$assigncols('omnis_pref1','iPref1')
Do $cinst.$clientcommand("loadpreference",lPrefRow) Returns #F
Do method process (iPref1)
The “process” method is a server executed method and will receive the loaded content. Note that iPref1 needs to be an instance variable though.
You can then use this information to make a $changeform or assign a specific subform if you wish.
I hope this helps.
Best,
Andreas
-
This reply was modified 10 months, 3 weeks ago by
Andreas Pfeiffer.
-
This reply was modified 10 months, 3 weeks ago by
-
Andreas Pfeiffer
AdministratorJanuary 1, 2025 at 11:48 am in reply to: Merging list losing smart propertiesMartin,
Talking about importing data you might be interested in those technical notes:
https://www.omnis.net/developers/resources/technotes/tnls0002.jsp
https://www.omnis.net/developers/resources/technotes/tnjs0011.jsp
Best and Happy New Year!
Andreas
omnis.net
Omnis Technical Notes - Importing a CSV file into a list
Omnis Technical Notes - Importing a CSV file into a list
-
Andreas Pfeiffer
AdministratorDecember 17, 2024 at 8:49 am in reply to: Dialogform container messagingMartin,
You are very welcome!
Thanks for your feedback.
Have a great day.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 15, 2024 at 12:34 pm in reply to: Dialogform container messagingOk – so this would normally be part of the database responsibility. When you set up a unique index on that column the insert should fail and you could return a proper error message when inserting the data. But maybe you want this before hitting the “save” button I assume.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 15, 2024 at 12:22 pm in reply to: Dialogform container messagingYes – you could make your argument longer in the $sendall as well as in the $filter by using the ampercent “&” sign or the pipe symbol “|”. The ampercent is the logical “AND” and the pipe symbol is the “OR”. You can also use parentheses to group logical expressions.
That said a $sendall can become very long horizontally and therefore un-readable and hard to maintain. I would avoid too many logical arguments. What would you do if you would need to search for 100 columns?
That is the reason I broke it up into two separate methods (see the post below) but still using the $sendall to call the sub routine from the main method.
I hope this makes sense.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 15, 2024 at 12:17 pm in reply to: Dialogform container messagingMartin,
the pre-formatted tag is in the editor of this forum. When you enter text here there is a little formatting menu underneath which starts with something like “Aa”, camera symbol, attachment symbol, smiley. Click on the “Aa” which opens the text formatting feature. This allows you to make the text bold, italic add bullet points. The one which looks like </> is the pre-formatted text that allows you to copy and paste code freely without being scared that it will look weird. I use this for the coding part.
Best,
Andreas
-
Andreas Pfeiffer
AdministratorDecember 15, 2024 at 12:12 pm in reply to: Dialogform container messagingMartin,
I am not so sure if this is always what you want. For example if you are checking the “name” column and the “city” column – as per your description – it will not allow to have a record where the city is the same as in any other record. Ok – you wouldn’t probably check city. It might be a bad example then.
However I enhanced the code a little bit. As for table classes “$cinst” always refers to the list (or row) that is used with that table class. Or in other words: The list is the instance of the table class.
First you were asking for a one liner in $hidenonduplicates formerly know as $showduplicates:
Do $cinst.$sort($ref.[pColumnName]) ## sorts the list on that column
Do $cinst.$sendall($ref.$selected.$assign(kTrue),$cinst.[$cinst.$line+1].[pColumnName]=$cinst.[pColumnName])
Note, that the assignment is always true if the filter returns true. I would normally put the part that is now in the filter into the assignment but hang on, you were asking to check multiple columns. Therefore I renamed the method into $hidenonduplicates.
Now in the new $showduplicates the parameter becomes a row “pColumnNameRow”:
Do $cinst.$sendall($ref.$selected.$assign(kFalse)) ## make sure no line is selected
Do $cinst.$smartlist.$assign(kTrue) ## that allows to use the $filter
Do $cinst.$unfilter() ## just in case we run this again
Do pColumnNameRow.$cols.$sendall($cinst.$hidenonduplicates(pColumnNameRow.[$ref.$name]))
Do $cinst.$filter($ref.$selected)
<font face=”inherit”>As you see here the first line is making all lines of the list un-selected. Also this is the place to make the list becoming a </font>smart list and un-filter.
It is the using a sendall that loops through the columns of the parameter row and calls the $hidenonduplicates method with the content of each of the values in that row.
That way you can now select all possible duplicates several times – actually for each column of the parameter row.
I also changed the $hasduplicates method so that it actually uses the same approach but removes the filter before the stack ends. Only returns if there are actually duplicates or not:
Do $cinst.$showduplicates(pColumnNameRow)
Calculate lHasDuplicates as $cinst.$linecount>0
Do $cinst.$unfilter() ## we do not want to filter in this case
Quit method lHasDuplicates
lHasDuplicates is a boolean local variable.
Next you would need to change the call. So instead using a scalar parameter you would need to use the row() function for the new methods, i.e.
Do iDataList.$hasduplicates(row(‘name’,’city’))
I think there are still some caveats with this approach. What if you want to find duplicates where only two or more columns together determine if this is a double record?
Or if a record is double, as for now the selection is on the first record sorted on that column. Meaning that if you have two records with the name “Charly” it will then mark the first Charly as the double one. No clue if that is fine or if you better select the 2nd one?
Attached please find the new library.
Best,
Andreas