<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API Database_control example Error in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237739#M4246</link>
    <description>&lt;BLOCKQUOTE&gt;park wrote:&lt;BR /&gt;
before&lt;BR /&gt;
DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));&lt;BR /&gt;
book-&amp;gt;release ();&lt;BR /&gt;
&lt;BR /&gt;
after&lt;BR /&gt;
bool aaaa= book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath))&lt;BR /&gt;
book-&amp;gt;release();&lt;BR /&gt;
&lt;BR /&gt;
After making the above changes, an Excel file was created in the Documents folder.
&lt;/BLOCKQUOTE&gt;

I get the following errors when the change mentioned is made, any suggestions why?&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Warning	C4189	'aaaa': local variable is initialized but not referenced	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Examples\Database_Control\Src\Database_Control.cpp	1458	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0028	expression must have a constant value	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	62	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0028	expression must have a constant value	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	62	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0145	member "GS::GSException::AlignOfUniString" may not be initialized	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	56	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0145	member "GS::GSException::SizeOfUniString" may not be initialized	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	57	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error	C2220	warning treated as error - no 'object' file generated	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Examples\Database_Control\Src\Database_Control.cpp	1458</description>
    <pubDate>Sat, 01 Dec 2018 06:01:57 GMT</pubDate>
    <dc:creator>SajW</dc:creator>
    <dc:date>2018-12-01T06:01:57Z</dc:date>
    <item>
      <title>API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237733#M4240</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I am practicing database control to practice the addon which outputs element attribute value to excel file in Archicad. (Static void Do_ExportWallsToExcel (void) function )There is problem that it is not saved in the place where Excel file is saved in executable file.
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;static void	Do_ExportWallsToExcel (void)
{
	DBPrintf ("Exporting walls to Excel document...\n");

	libxl::Book* book = xlCreateXMLBook ();
	libxl::Sheet* sheet = book-&amp;gt;addSheet (UNISTR_TO_LIBXLSTR (GS::UniString("Walls exported from Archicad")));

	libxl::Font* guidFormatFont = book-&amp;gt;addFont ();
	guidFormatFont-&amp;gt;setSize (6);
	guidFormatFont-&amp;gt;setColor (libxl::COLOR_GRAY50);
	libxl::Format* guidFormat = book-&amp;gt;addFormat ();
	guidFormat-&amp;gt;setFont (guidFormatFont);

	GS::Array&amp;lt;GS::UniString&amp;gt; titles;
	titles.Push ("GUID");
	titles.Push ("Height");
	titles.Push ("BeginCoordX");
	titles.Push ("BeginCoordY");
	titles.Push ("EndCoordX");
	titles.Push ("EndCoordY");

	for (UIndex i = 0; i &amp;lt; titles.GetSize (); ++i) {
		sheet-&amp;gt;writeStr (0, i, UNISTR_TO_LIBXLSTR (titles&lt;I&gt;));
	}

	GS::Array&amp;lt;API_Guid&amp;gt; apiguids;
	ACAPI_Element_GetElemList (API_WallID, &amp;amp;apiguids);
	for (UIndex i = 0; i &amp;lt; apiguids.GetSize (); ++i) {
		GS::Guid gsguid = APIGuid2GSGuid (apiguids&lt;I&gt;);

		API_Element element = {};
		element.header.guid = apiguids&lt;I&gt;;
		GSErrCode err = ACAPI_Element_Get (&amp;amp;element);
		if (err != NoError) {
			DBPrintf ("ACAPI_Element_Get returned error (%d) for GUID '%s'\n", err,
					  gsguid.ToUniString ().ToCStr ().Get ());
			continue;
		}

		API_WallType&amp;amp; wall = element.wall;
		//DBPrintf ("GUID '%s'\n", gsguid.ToUniString ().ToCStr ().Get ());

		sheet-&amp;gt;writeStr (i + 1, 0, UNISTR_TO_LIBXLSTR (gsguid.ToUniString ()), guidFormat);
		sheet-&amp;gt;writeNum (i + 1, 1, wall.height);
		sheet-&amp;gt;writeNum (i + 1, 2, wall.begC.x);
		sheet-&amp;gt;writeNum (i + 1, 3, wall.begC.y);
		sheet-&amp;gt;writeNum (i + 1, 4, wall.endC.x);
		sheet-&amp;gt;writeNum (i + 1, 5, wall.endC.y);
	}

	IO::Location location;
	IO::fileSystem.GetSpecialLocation (IO::FileSystem::UserDocuments, &amp;amp;location);
	
	location.AppendToLocal (IO::Name ("export.xlsx"));
	GS::UniString filepath;
	location.ToPath (&amp;amp;filepath);
	
	DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));
	book-&amp;gt;release ();

	DBPrintf ("Export operation finished\n");
}
&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 30 Nov 2022 09:45:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237733#M4240</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-11-30T09:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237734#M4241</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
This example code saves the excel file into the user's documentation folder. Of course you can configure it as you want.&lt;BR /&gt;
&lt;BR /&gt;
This part of the code gets the documents folder and sets the excel filename to "export.xlsx":
&lt;PRE&gt;	IO::Location location;
	IO::fileSystem.GetSpecialLocation (IO::FileSystem::UserDocuments, &amp;amp;location);

	location.AppendToLocal (IO::Name ("export.xlsx"));&lt;/PRE&gt;

Don't you find the "export.xlsx" file in you documentation folder after executing this operation?</description>
      <pubDate>Mon, 27 Aug 2018 08:56:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237734#M4241</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2018-08-27T08:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237735#M4242</link>
      <description>before&lt;BR /&gt;
DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));&lt;BR /&gt;
book-&amp;gt;release ();&lt;BR /&gt;
&lt;BR /&gt;
after&lt;BR /&gt;
bool aaaa= book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath))&lt;BR /&gt;
book-&amp;gt;release();&lt;BR /&gt;
&lt;BR /&gt;
After making the above changes, an Excel file was created in the Documents folder.</description>
      <pubDate>Tue, 28 Aug 2018 07:15:18 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237735#M4242</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-08-28T07:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237736#M4243</link>
      <description>Yes, you're absolutely right. The code inside DBASSERT runs only if you built your AddOn using Debug configuration.
&lt;BLOCKQUOTE&gt;park wrote:&lt;BR /&gt;
DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));
&lt;/BLOCKQUOTE&gt;
I'm glad that you solved the issue and you can continue the AddOn development!</description>
      <pubDate>Tue, 28 Aug 2018 07:42:09 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237736#M4243</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2018-08-28T07:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237737#M4244</link>
      <description>&lt;BLOCKQUOTE&gt;Tibor wrote:&lt;BR /&gt;
Yes, you're absolutely right. The code inside DBASSERT runs only if you built your AddOn using Debug configuration.
&lt;BLOCKQUOTE&gt;park wrote:&lt;BR /&gt;
DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));
&lt;/BLOCKQUOTE&gt;
I'm glad that you solved the issue and you can continue the AddOn development!
&lt;/BLOCKQUOTE&gt;

This is an excellent reason for anyone posting here in the Developer Forum to make clear if they are experimenting with the API using ARCHICAD in Demo mode - or if they have an API license key and are testing in a production license.&lt;BR /&gt;
&lt;BR /&gt;
A reminder to all - without a valid developer ID, your add-on can only operate in Demo mode  - which has save, print and other features disabled ... including the normal creation of files as seen here.   Mr Park's workaround for saving information while in demo mode is an intriguing tip that may help others. &lt;E&gt;&lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/E&gt;</description>
      <pubDate>Tue, 28 Aug 2018 17:31:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237737#M4244</guid>
      <dc:creator>Karl Ottenstein</dc:creator>
      <dc:date>2018-08-28T17:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237738#M4245</link>
      <description>I'm testing on valid ID and still had to use this trick.  &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt; It works anyway &lt;IMG src="https://community.graphisoft.com/legacyfs/online/emojis/icon_biggrin.gif" style="display : inline;" /&gt;</description>
      <pubDate>Tue, 11 Sep 2018 10:13:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237738#M4245</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-09-11T10:13:48Z</dc:date>
    </item>
    <item>
      <title>Re: API Database_control example Error</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237739#M4246</link>
      <description>&lt;BLOCKQUOTE&gt;park wrote:&lt;BR /&gt;
before&lt;BR /&gt;
DBASSERT (book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath)));&lt;BR /&gt;
book-&amp;gt;release ();&lt;BR /&gt;
&lt;BR /&gt;
after&lt;BR /&gt;
bool aaaa= book-&amp;gt;save (UNISTR_TO_LIBXLSTR(filepath))&lt;BR /&gt;
book-&amp;gt;release();&lt;BR /&gt;
&lt;BR /&gt;
After making the above changes, an Excel file was created in the Documents folder.
&lt;/BLOCKQUOTE&gt;

I get the following errors when the change mentioned is made, any suggestions why?&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Warning	C4189	'aaaa': local variable is initialized but not referenced	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Examples\Database_Control\Src\Database_Control.cpp	1458	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0028	expression must have a constant value	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	62	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0028	expression must have a constant value	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	62	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0145	member "GS::GSException::AlignOfUniString" may not be initialized	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	56	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error (active)	E0145	member "GS::GSException::SizeOfUniString" may not be initialized	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Support\Modules\GSRoot\GSException.hpp	57	&lt;BR /&gt;
&lt;BR /&gt;
Severity	Code	Description	Project	File	Line	Suppression State&lt;BR /&gt;
Error	C2220	warning treated as error - no 'object' file generated	Database_Control	C:\Program Files\GRAPHISOFT\API Development Kit 22.3004\Examples\Database_Control\Src\Database_Control.cpp	1458</description>
      <pubDate>Sat, 01 Dec 2018 06:01:57 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/API-Database-control-example-Error/m-p/237739#M4246</guid>
      <dc:creator>SajW</dc:creator>
      <dc:date>2018-12-01T06:01:57Z</dc:date>
    </item>
  </channel>
</rss>

